diff options
Diffstat (limited to 'lib/Data/Packed/Vector.hs')
-rw-r--r-- | lib/Data/Packed/Vector.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 6415c5c..0bbbc34 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -24,6 +24,7 @@ module Data.Packed.Vector ( | |||
24 | 24 | ||
25 | import Data.Packed.Internal | 25 | import Data.Packed.Internal |
26 | import Numeric.GSL.Vector | 26 | import Numeric.GSL.Vector |
27 | import Data.Packed.ST | ||
27 | 28 | ||
28 | {- | Creates a real vector containing a range of values: | 29 | {- | Creates a real vector containing a range of values: |
29 | 30 | ||
@@ -47,3 +48,11 @@ vectorMaxIndex = round . toScalarR MaxIdx | |||
47 | 48 | ||
48 | vectorMinIndex :: Vector Double -> Int | 49 | vectorMinIndex :: Vector Double -> Int |
49 | vectorMinIndex = round . toScalarR MinIdx | 50 | vectorMinIndex = round . toScalarR MinIdx |
51 | |||
52 | {- | creates a vector with a given number of equal components: | ||
53 | |||
54 | @> constant 2 7 | ||
55 | 7 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0]@ | ||
56 | -} | ||
57 | constant :: Element a => a -> Int -> Vector a | ||
58 | constant x n = runSTVector (newVector x n) | ||