diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-05 09:21:57 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-07-05 09:21:57 +0000 |
commit | 21ccf5342555bd41a61ed132b09eacebf3c71feb (patch) | |
tree | bad2e548a20ea0d1dbe3813199e40b315634ac7d /lib/Data | |
parent | dd054da0524abdb14d013c9f9f43272515b77b6e (diff) |
added Vectors typeclass and refactored
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/Packed/Internal/Signatures.hs | 4 | ||||
-rw-r--r-- | lib/Data/Packed/Vector.hs | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/Data/Packed/Internal/Signatures.hs b/lib/Data/Packed/Internal/Signatures.hs index 4d984e3..1370dbc 100644 --- a/lib/Data/Packed/Internal/Signatures.hs +++ b/lib/Data/Packed/Internal/Signatures.hs | |||
@@ -20,6 +20,7 @@ import Foreign.C.Types | |||
20 | 20 | ||
21 | type PF = Ptr Float -- | 21 | type PF = Ptr Float -- |
22 | type PD = Ptr Double -- | 22 | type PD = Ptr Double -- |
23 | type PQ = Ptr (Complex Float) -- | ||
23 | type PC = Ptr (Complex Double) -- | 24 | type PC = Ptr (Complex Double) -- |
24 | type TF = CInt -> PF -> IO CInt -- | 25 | type TF = CInt -> PF -> IO CInt -- |
25 | type TFF = CInt -> PF -> TF -- | 26 | type TFF = CInt -> PF -> TF -- |
@@ -53,6 +54,9 @@ type TCMCMCM = CInt -> CInt -> PC -> TCMCM -- | |||
53 | type TCV = CInt -> PC -> IO CInt -- | 54 | type TCV = CInt -> PC -> IO CInt -- |
54 | type TCVCV = CInt -> PC -> TCV -- | 55 | type TCVCV = CInt -> PC -> TCV -- |
55 | type TCVCVCV = CInt -> PC -> TCVCV -- | 56 | type TCVCVCV = CInt -> PC -> TCVCV -- |
57 | type TQV = CInt -> PQ -> IO CInt -- | ||
58 | type TQVQV = CInt -> PQ -> TQV -- | ||
59 | type TQVQVQV = CInt -> PQ -> TQVQV -- | ||
56 | type TCMCV = CInt -> CInt -> PC -> TCV -- | 60 | type TCMCV = CInt -> CInt -> PC -> TCV -- |
57 | type TVCV = CInt -> PD -> TCV -- | 61 | type TVCV = CInt -> PD -> TCV -- |
58 | type TCVM = CInt -> PC -> TM -- | 62 | type TCVM = CInt -> PC -> TM -- |
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 4f25b6f..62fc8af 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -19,8 +19,9 @@ module Data.Packed.Vector ( | |||
19 | subVector, takesV, join, | 19 | subVector, takesV, join, |
20 | constant, linspace, | 20 | constant, linspace, |
21 | vecdisp, | 21 | vecdisp, |
22 | vectorFMax, vectorFMin, vectorFMaxIndex, vectorFMinIndex, | 22 | -- moved to Numeric.LinearAlgebra.Interface typeclass |
23 | vectorMax, vectorMin, vectorMaxIndex, vectorMinIndex, | 23 | -- vectorFMax, vectorFMin, vectorFMaxIndex, vectorFMinIndex, |
24 | -- vectorMax, vectorMin, vectorMaxIndex, vectorMinIndex, | ||
24 | mapVector, zipVector, | 25 | mapVector, zipVector, |
25 | fscanfVector, fprintfVector, freadVector, fwriteVector, | 26 | fscanfVector, fprintfVector, freadVector, fwriteVector, |
26 | foldLoop, foldVector, foldVectorG | 27 | foldLoop, foldVector, foldVectorG |
@@ -82,6 +83,7 @@ linspace n (a,b) = add a $ scale s $ fromList [0 .. fromIntegral n-1] | |||
82 | add = vectorMapValR AddConstant | 83 | add = vectorMapValR AddConstant |
83 | s = (b-a)/fromIntegral (n-1) | 84 | s = (b-a)/fromIntegral (n-1) |
84 | 85 | ||
86 | {- | ||
85 | vectorFMax :: Vector Float -> Float | 87 | vectorFMax :: Vector Float -> Float |
86 | vectorFMax = toScalarF Max | 88 | vectorFMax = toScalarF Max |
87 | 89 | ||
@@ -105,6 +107,7 @@ vectorMaxIndex = round . toScalarR MaxIdx | |||
105 | 107 | ||
106 | vectorMinIndex :: Vector Double -> Int | 108 | vectorMinIndex :: Vector Double -> Int |
107 | vectorMinIndex = round . toScalarR MinIdx | 109 | vectorMinIndex = round . toScalarR MinIdx |
110 | -} | ||
108 | 111 | ||
109 | {- | creates a vector with a given number of equal components: | 112 | {- | creates a vector with a given number of equal components: |
110 | 113 | ||