diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-09-14 11:06:57 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-09-14 11:06:57 +0000 |
commit | 9e2f7fb0ca902665b430a96f77959522976a97f9 (patch) | |
tree | c2f258fe28df79a645f3908655b46fbaf89ecf16 /lib/Data/Packed/Vector.hs | |
parent | 620d5008ea9a931a91907cd0c902bb64f005121f (diff) |
code refactoring
Diffstat (limited to 'lib/Data/Packed/Vector.hs')
-rw-r--r-- | lib/Data/Packed/Vector.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 9818d58..3fc625c 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -18,12 +18,13 @@ module Data.Packed.Vector ( | |||
18 | dim, (@>), | 18 | dim, (@>), |
19 | subVector, join, | 19 | subVector, join, |
20 | constant, linspace, | 20 | constant, linspace, |
21 | 21 | vectorMax, vectorMin, vectorMaxIndex, vectorMinIndex, | |
22 | liftVector, liftVector2 | 22 | liftVector, liftVector2 |
23 | ) where | 23 | ) where |
24 | 24 | ||
25 | import Data.Packed.Internal | 25 | import Data.Packed.Internal |
26 | import Complex | 26 | import Complex |
27 | import GSL.Vector | ||
27 | 28 | ||
28 | {- | Creates a real vector containing a range of values: | 29 | {- | Creates a real vector containing a range of values: |
29 | 30 | ||
@@ -33,3 +34,15 @@ import Complex | |||
33 | linspace :: Int -> (Double, Double) -> Vector Double | 34 | linspace :: Int -> (Double, Double) -> Vector Double |
34 | linspace n (a,b) = fromList [a, a+delta .. b] | 35 | linspace n (a,b) = fromList [a, a+delta .. b] |
35 | where delta = (b-a)/(fromIntegral n -1) | 36 | where delta = (b-a)/(fromIntegral n -1) |
37 | |||
38 | vectorMax :: Vector Double -> Double | ||
39 | vectorMax = toScalarR Max | ||
40 | |||
41 | vectorMin :: Vector Double -> Double | ||
42 | vectorMin = toScalarR Min | ||
43 | |||
44 | vectorMaxIndex :: Vector Double -> Int | ||
45 | vectorMaxIndex = round . toScalarR MaxIdx | ||
46 | |||
47 | vectorMinIndex :: Vector Double -> Int | ||
48 | vectorMinIndex = round . toScalarR MinIdx | ||