diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-06-29 09:03:19 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-06-29 09:03:19 +0000 |
commit | 4957cff8af91cbb23c12382e25f5373fe96acb95 (patch) | |
tree | 2f2968d5ca88f7d76e208982b8938c4dfc46ce8a /lib/Numeric/GSL/Vector.hs | |
parent | d18a86d37d55a39d4ec9b16397dd59f35aa13688 (diff) |
add-vector-float
Diffstat (limited to 'lib/Numeric/GSL/Vector.hs')
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index 28c3b06..d09323b 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs | |||
@@ -14,10 +14,10 @@ | |||
14 | ----------------------------------------------------------------------------- | 14 | ----------------------------------------------------------------------------- |
15 | 15 | ||
16 | module Numeric.GSL.Vector ( | 16 | module Numeric.GSL.Vector ( |
17 | FunCodeS(..), toScalarR, | 17 | FunCodeS(..), toScalarR, toScalarF, |
18 | FunCodeV(..), vectorMapR, vectorMapC, | 18 | FunCodeV(..), vectorMapR, vectorMapC, vectorMapF, |
19 | FunCodeSV(..), vectorMapValR, vectorMapValC, | 19 | FunCodeSV(..), vectorMapValR, vectorMapValC, vectorMapValF, |
20 | FunCodeVV(..), vectorZipR, vectorZipC, | 20 | FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, |
21 | RandDist(..), randomVector | 21 | RandDist(..), randomVector |
22 | ) where | 22 | ) where |
23 | 23 | ||
@@ -106,6 +106,12 @@ toScalarR oper = toScalarAux c_toScalarR (fromei oper) | |||
106 | 106 | ||
107 | foreign import ccall safe "gsl-aux.h toScalarR" c_toScalarR :: CInt -> TVV | 107 | foreign import ccall safe "gsl-aux.h toScalarR" c_toScalarR :: CInt -> TVV |
108 | 108 | ||
109 | -- | obtains different functions of a vector: norm1, norm2, max, min, posmax, posmin, etc. | ||
110 | toScalarF :: FunCodeS -> Vector Float -> Float | ||
111 | toScalarF oper = toScalarAux c_toScalarF (fromei oper) | ||
112 | |||
113 | foreign import ccall safe "gsl-aux.h toScalarF" c_toScalarF :: CInt -> TFF | ||
114 | |||
109 | ------------------------------------------------------------------ | 115 | ------------------------------------------------------------------ |
110 | 116 | ||
111 | -- | map of real vectors with given function | 117 | -- | map of real vectors with given function |
@@ -120,6 +126,12 @@ vectorMapC oper = vectorMapAux c_vectorMapC (fromei oper) | |||
120 | 126 | ||
121 | foreign import ccall safe "gsl-aux.h mapC" c_vectorMapC :: CInt -> TCVCV | 127 | foreign import ccall safe "gsl-aux.h mapC" c_vectorMapC :: CInt -> TCVCV |
122 | 128 | ||
129 | -- | map of real vectors with given function | ||
130 | vectorMapF :: FunCodeV -> Vector Float -> Vector Float | ||
131 | vectorMapF = vectorMapAux c_vectorMapF | ||
132 | |||
133 | foreign import ccall safe "gsl-aux.h mapF" c_vectorMapF :: CInt -> TFF | ||
134 | |||
123 | ------------------------------------------------------------------- | 135 | ------------------------------------------------------------------- |
124 | 136 | ||
125 | -- | map of real vectors with given function | 137 | -- | map of real vectors with given function |
@@ -134,6 +146,12 @@ vectorMapValC = vectorMapValAux c_vectorMapValC | |||
134 | 146 | ||
135 | foreign import ccall safe "gsl-aux.h mapValC" c_vectorMapValC :: CInt -> Ptr (Complex Double) -> TCVCV | 147 | foreign import ccall safe "gsl-aux.h mapValC" c_vectorMapValC :: CInt -> Ptr (Complex Double) -> TCVCV |
136 | 148 | ||
149 | -- | map of real vectors with given function | ||
150 | vectorMapValF :: FunCodeSV -> Float -> Vector Float -> Vector Float | ||
151 | vectorMapValF oper = vectorMapValAux c_vectorMapValF (fromei oper) | ||
152 | |||
153 | foreign import ccall safe "gsl-aux.h mapValF" c_vectorMapValF :: CInt -> Ptr Float -> TFF | ||
154 | |||
137 | ------------------------------------------------------------------- | 155 | ------------------------------------------------------------------- |
138 | 156 | ||
139 | -- | elementwise operation on real vectors | 157 | -- | elementwise operation on real vectors |
@@ -148,6 +166,12 @@ vectorZipC = vectorZipAux c_vectorZipC | |||
148 | 166 | ||
149 | foreign import ccall safe "gsl-aux.h zipC" c_vectorZipC :: CInt -> TCVCVCV | 167 | foreign import ccall safe "gsl-aux.h zipC" c_vectorZipC :: CInt -> TCVCVCV |
150 | 168 | ||
169 | -- | elementwise operation on real vectors | ||
170 | vectorZipF :: FunCodeVV -> Vector Float -> Vector Float -> Vector Float | ||
171 | vectorZipF = vectorZipAux c_vectorZipF | ||
172 | |||
173 | foreign import ccall safe "gsl-aux.h zipF" c_vectorZipF :: CInt -> TFFF | ||
174 | |||
151 | ----------------------------------------------------------------------- | 175 | ----------------------------------------------------------------------- |
152 | 176 | ||
153 | data RandDist = Uniform -- ^ uniform distribution in [0,1) | 177 | data RandDist = Uniform -- ^ uniform distribution in [0,1) |