diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Numeric/ContainerBoot.hs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs index e33857a..276eaa8 100644 --- a/lib/Numeric/ContainerBoot.hs +++ b/lib/Numeric/ContainerBoot.hs | |||
@@ -121,14 +121,24 @@ class (Complexable c, Fractional e, Element e) => Container c e where | |||
121 | sumElements :: c e -> e | 121 | sumElements :: c e -> e |
122 | -- | the product of elements (faster than using @fold@) | 122 | -- | the product of elements (faster than using @fold@) |
123 | prodElements :: c e -> e | 123 | prodElements :: c e -> e |
124 | -- | map (if x_i>0 then 1.0 else 0.0) | 124 | -- | a more efficient implementation of @cmap (\x -> if x>0 then 1 else 0)@ |
125 | step :: RealFloat e => c e -> c e | 125 | step :: RealElement e => c e -> c e |
126 | -- | find index of elements which satisfy a predicate | 126 | -- | find index of elements which satisfy a predicate |
127 | find :: (e -> Bool) -> c e -> [IndexOf c] | 127 | find :: (e -> Bool) -> c e -> [IndexOf c] |
128 | -- | create a structure from an association list | 128 | -- | create a structure from an association list |
129 | assoc :: IndexOf c -> e -> [(IndexOf c, e)] -> c e | 129 | assoc :: IndexOf c -- ^ size |
130 | -- | a vectorized form of case 'compare' a_i b_i of LT -> l_i; EQ -> e_i; GT -> g_i | 130 | -> e -- ^ default value |
131 | cond :: RealFloat e => c e -> c e -> c e -> c e -> c e -> c e | 131 | -> [(IndexOf c, e)] -- ^ association list |
132 | -> c e -- ^ result | ||
133 | |||
134 | -- | element by element @case compare a b of LT -> l, EQ -> e, GT -> g@ | ||
135 | cond :: RealElement e | ||
136 | => c e -- ^ a | ||
137 | -> c e -- ^ b | ||
138 | -> c e -- ^ l | ||
139 | -> c e -- ^ e | ||
140 | -> c e -- ^ g | ||
141 | -> c e -- ^ result | ||
132 | 142 | ||
133 | -------------------------------------------------------------------------- | 143 | -------------------------------------------------------------------------- |
134 | 144 | ||