diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-06-22 10:21:15 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-06-22 10:21:15 +0000 |
commit | 989bdf7e88c13500bd1986dcde36f6cc4f467efb (patch) | |
tree | b30ff0dd52e2b6c2adb1dfe8759d03234f65c684 /lib | |
parent | aa14e6615533e7bd5e2b15acdc3ec76afbe1aac4 (diff) |
reverting to the old signatures for aux C functions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Common.hs | 39 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 25 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 9 | ||||
-rw-r--r-- | lib/GSL/Fourier.hs | 2 | ||||
-rw-r--r-- | lib/GSL/Minimization.hs | 6 | ||||
-rw-r--r-- | lib/GSL/Polynomials.hs | 2 | ||||
-rw-r--r-- | lib/GSL/Vector.hs | 14 | ||||
-rw-r--r-- | lib/LAPACK.hs | 26 |
8 files changed, 85 insertions, 38 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs index 91985f7..bdd7f34 100644 --- a/lib/Data/Packed/Internal/Common.hs +++ b/lib/Data/Packed/Internal/Common.hs | |||
@@ -86,3 +86,42 @@ scast = fromJust . cast | |||
86 | {- | conversion of Haskell functions into function pointers that can be used in the C side | 86 | {- | conversion of Haskell functions into function pointers that can be used in the C side |
87 | -} | 87 | -} |
88 | foreign import ccall "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr (Double -> Ptr() -> Double)) | 88 | foreign import ccall "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr (Double -> Ptr() -> Double)) |
89 | |||
90 | --------------------------------------------------- | ||
91 | -- ugly, but my haddock version doesn't understand | ||
92 | -- yet infix type constructors | ||
93 | --------------------------------------------------- | ||
94 | ---------- signatures of the C functions ------- | ||
95 | ------------------------------------------------ | ||
96 | type PD = Ptr Double -- | ||
97 | type PC = Ptr (Complex Double) -- | ||
98 | type TV = Int -> PD -> IO Int -- | ||
99 | type TVV = Int -> PD -> TV -- | ||
100 | type TVVV = Int -> PD -> TVV -- | ||
101 | type TM = Int -> Int -> PD -> IO Int -- | ||
102 | type TMM = Int -> Int -> PD -> TM -- | ||
103 | type TMMM = Int -> Int -> PD -> TMM -- | ||
104 | type TVM = Int -> PD -> TM -- | ||
105 | type TVVM = Int -> PD -> TVM -- | ||
106 | type TMV = Int -> Int -> PD -> TV -- | ||
107 | type TMVM = Int -> Int -> PD -> TVM -- | ||
108 | type TMMVM = Int -> Int -> PD -> TMVM -- | ||
109 | type TCM = Int -> Int -> PC -> IO Int -- | ||
110 | type TCVCM = Int -> PC -> TCM -- | ||
111 | type TCMCVCM = Int -> Int -> PC -> TCVCM -- | ||
112 | type TMCMCVCM = Int -> Int -> PD -> TCMCVCM -- | ||
113 | type TCMCMCVCM = Int -> Int -> PC -> TCMCVCM -- | ||
114 | type TCMCM = Int -> Int -> PC -> TCM -- | ||
115 | type TVCM = Int -> PD -> TCM -- | ||
116 | type TCMVCM = Int -> Int -> PC -> TVCM -- | ||
117 | type TCMCMVCM = Int -> Int -> PC -> TCMVCM -- | ||
118 | type TCMCMCM = Int -> Int -> PC -> TCMCM -- | ||
119 | type TCV = Int -> PC -> IO Int -- | ||
120 | type TCVCV = Int -> PC -> TCV -- | ||
121 | type TCVCVCV = Int -> PC -> TCVCV -- | ||
122 | type TCMCV = Int -> Int -> PC -> TCV -- | ||
123 | type TVCV = Int -> PD -> TCV -- | ||
124 | type TCVM = Int -> PC -> TM -- | ||
125 | type TMCVM = Int -> Int -> PD -> TCVM -- | ||
126 | type TMMCVM = Int -> Int -> PD -> TMCVM -- | ||
127 | ------------------------------------------------ | ||
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index fccf8bb..2925fc0 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -50,8 +50,9 @@ trans m = m { rows = cols m | |||
50 | } | 50 | } |
51 | 51 | ||
52 | type Mt t s = Int -> Int -> Ptr t -> s | 52 | type Mt t s = Int -> Int -> Ptr t -> s |
53 | infixr 6 ::> | 53 | -- not yet admitted by my haddock version |
54 | type t ::> s = Mt t s | 54 | -- infixr 6 ::> |
55 | -- type t ::> s = Mt t s | ||
55 | 56 | ||
56 | mat d m f = f (rows m) (cols m) (ptr (d m)) | 57 | mat d m f = f (rows m) (cols m) (ptr (d m)) |
57 | 58 | ||
@@ -117,9 +118,9 @@ transdataAux fun c1 d c2 = | |||
117 | noneed = r1 == 1 || c1 == 1 | 118 | noneed = r1 == 1 || c1 == 1 |
118 | 119 | ||
119 | foreign import ccall safe "aux.h transR" | 120 | foreign import ccall safe "aux.h transR" |
120 | ctransR :: Double ::> Double ::> IO Int | 121 | ctransR :: TMM -- Double ::> Double ::> IO Int |
121 | foreign import ccall safe "aux.h transC" | 122 | foreign import ccall safe "aux.h transC" |
122 | ctransC :: Complex Double ::> Complex Double ::> IO Int | 123 | ctransC :: TCMCM -- Complex Double ::> Complex Double ::> IO Int |
123 | 124 | ||
124 | transdata :: Field a => Int -> Vector a -> Int -> Vector a | 125 | transdata :: Field a => Int -> Vector a -> Int -> Vector a |
125 | transdata c1 d c2 | isReal baseOf d = scast $ transdataR c1 (scast d) c2 | 126 | transdata c1 d c2 | isReal baseOf d = scast $ transdataR c1 (scast d) c2 |
@@ -170,10 +171,16 @@ multiplyAux order fun a b = unsafePerformIO $ do | |||
170 | return r | 171 | return r |
171 | 172 | ||
172 | foreign import ccall safe "aux.h multiplyR" | 173 | foreign import ccall safe "aux.h multiplyR" |
173 | cmultiplyR :: Int -> Double ::> (Int -> Double ::> (Double ::> IO Int)) | 174 | cmultiplyR :: Int -> Int -> Int -> Ptr Double |
175 | -> Int -> Int -> Int -> Ptr Double | ||
176 | -> Int -> Int -> Ptr Double | ||
177 | -> IO Int | ||
174 | 178 | ||
175 | foreign import ccall safe "aux.h multiplyC" | 179 | foreign import ccall safe "aux.h multiplyC" |
176 | cmultiplyC :: Int -> Complex Double ::> (Int -> Complex Double ::> (Complex Double ::> IO Int)) | 180 | cmultiplyC :: Int -> Int -> Int -> Ptr (Complex Double) |
181 | -> Int -> Int -> Int -> Ptr (Complex Double) | ||
182 | -> Int -> Int -> Ptr (Complex Double) | ||
183 | -> IO Int | ||
177 | 184 | ||
178 | multiply :: (Num a, Field a) => MatrixOrder -> Matrix a -> Matrix a -> Matrix a | 185 | multiply :: (Num a, Field a) => MatrixOrder -> Matrix a -> Matrix a -> Matrix a |
179 | multiply RowMajor a b = multiplyD RowMajor a b | 186 | multiply RowMajor a b = multiplyD RowMajor a b |
@@ -206,7 +213,7 @@ subMatrixR (r0,c0) (rt,ct) x = unsafePerformIO $ do | |||
206 | c_submatrixR r0 (r0+rt-1) c0 (c0+ct-1) // mat cdat x // mat cdat r // check "subMatrixR" [dat r] | 213 | c_submatrixR r0 (r0+rt-1) c0 (c0+ct-1) // mat cdat x // mat cdat r // check "subMatrixR" [dat r] |
207 | return r | 214 | return r |
208 | foreign import ccall "aux.h submatrixR" | 215 | foreign import ccall "aux.h submatrixR" |
209 | c_submatrixR :: Int -> Int -> Int -> Int -> Double ::> Double ::> IO Int | 216 | c_submatrixR :: Int -> Int -> Int -> Int -> TMM |
210 | 217 | ||
211 | -- | extraction of a submatrix of a complex matrix | 218 | -- | extraction of a submatrix of a complex matrix |
212 | subMatrixC :: (Int,Int) -- ^ (r0,c0) starting position | 219 | subMatrixC :: (Int,Int) -- ^ (r0,c0) starting position |
@@ -239,12 +246,12 @@ diagAux fun msg (v@V {dim = n}) = unsafePerformIO $ do | |||
239 | -- | diagonal matrix from a real vector | 246 | -- | diagonal matrix from a real vector |
240 | diagR :: Vector Double -> Matrix Double | 247 | diagR :: Vector Double -> Matrix Double |
241 | diagR = diagAux c_diagR "diagR" | 248 | diagR = diagAux c_diagR "diagR" |
242 | foreign import ccall "aux.h diagR" c_diagR :: Double :> Double ::> IO Int | 249 | foreign import ccall "aux.h diagR" c_diagR :: TVM |
243 | 250 | ||
244 | -- | diagonal matrix from a real vector | 251 | -- | diagonal matrix from a real vector |
245 | diagC :: Vector (Complex Double) -> Matrix (Complex Double) | 252 | diagC :: Vector (Complex Double) -> Matrix (Complex Double) |
246 | diagC = diagAux c_diagC "diagC" | 253 | diagC = diagAux c_diagC "diagC" |
247 | foreign import ccall "aux.h diagC" c_diagC :: (Complex Double) :> (Complex Double) ::> IO Int | 254 | foreign import ccall "aux.h diagC" c_diagC :: TCVCM |
248 | 255 | ||
249 | -- | diagonal matrix from a vector | 256 | -- | diagonal matrix from a vector |
250 | diag :: (Num a, Field a) => Vector a -> Matrix a | 257 | diag :: (Num a, Field a) => Vector a -> Matrix a |
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index 125df1e..8848062 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -21,8 +21,9 @@ import Complex | |||
21 | import Control.Monad(when) | 21 | import Control.Monad(when) |
22 | 22 | ||
23 | type Vc t s = Int -> Ptr t -> s | 23 | type Vc t s = Int -> Ptr t -> s |
24 | infixr 5 :> | 24 | -- not yet admitted by my haddock version |
25 | type t :> s = Vc t s | 25 | -- infixr 5 :> |
26 | -- type t :> s = Vc t s | ||
26 | 27 | ||
27 | vec :: Vector t -> (Vc t s) -> s | 28 | vec :: Vector t -> (Vc t s) -> s |
28 | vec v f = f (dim v) (ptr v) | 29 | vec v f = f (dim v) (ptr v) |
@@ -118,10 +119,10 @@ constantAux fun n x = unsafePerformIO $ do | |||
118 | return v | 119 | return v |
119 | 120 | ||
120 | foreign import ccall safe "aux.h constantR" | 121 | foreign import ccall safe "aux.h constantR" |
121 | cconstantR :: Ptr Double -> Double :> IO Int | 122 | cconstantR :: Ptr Double -> TV -- Double :> IO Int |
122 | 123 | ||
123 | foreign import ccall safe "aux.h constantC" | 124 | foreign import ccall safe "aux.h constantC" |
124 | cconstantC :: Ptr (Complex Double) -> Complex Double :> IO Int | 125 | cconstantC :: Ptr (Complex Double) -> TCV -- Complex Double :> IO Int |
125 | 126 | ||
126 | constant :: Field a => Int -> a -> Vector a | 127 | constant :: Field a => Int -> a -> Vector a |
127 | constant n x | isReal id x = scast $ constantR n (scast x) | 128 | constant n x | isReal id x = scast $ constantR n (scast x) |
diff --git a/lib/GSL/Fourier.hs b/lib/GSL/Fourier.hs index c8c79f0..bf6cd60 100644 --- a/lib/GSL/Fourier.hs +++ b/lib/GSL/Fourier.hs | |||
@@ -29,7 +29,7 @@ genfft code v = unsafePerformIO $ do | |||
29 | c_fft code // vec v // vec r // check "fft" [v] | 29 | c_fft code // vec v // vec r // check "fft" [v] |
30 | return r | 30 | return r |
31 | 31 | ||
32 | foreign import ccall "gsl-aux.h fft" c_fft :: Int -> Complex Double :> Complex Double :> IO Int | 32 | foreign import ccall "gsl-aux.h fft" c_fft :: Int -> TCVCV -- Complex Double :> Complex Double :> IO Int |
33 | 33 | ||
34 | 34 | ||
35 | {- | Fast 1D Fourier transform of a 'Vector' @(@'Complex' 'Double'@)@ using /gsl_fft_complex_forward/. It uses the same scaling conventions as GNU Octave. | 35 | {- | Fast 1D Fourier transform of a 'Vector' @(@'Complex' 'Double'@)@ using /gsl_fft_complex_forward/. It uses the same scaling conventions as GNU Octave. |
diff --git a/lib/GSL/Minimization.hs b/lib/GSL/Minimization.hs index bc228a7..32b266f 100644 --- a/lib/GSL/Minimization.hs +++ b/lib/GSL/Minimization.hs | |||
@@ -97,7 +97,7 @@ minimizeNMSimplex f xi sz tol maxit = unsafePerformIO $ do | |||
97 | 97 | ||
98 | foreign import ccall "gsl-aux.h minimize" | 98 | foreign import ccall "gsl-aux.h minimize" |
99 | c_minimizeNMSimplex:: FunPtr (Int -> Ptr Double -> Double) -> Double -> Int | 99 | c_minimizeNMSimplex:: FunPtr (Int -> Ptr Double -> Double) -> Double -> Int |
100 | -> Double :> Double :> Double ::> IO Int | 100 | -> TVVM -- Double :> Double :> Double ::> IO Int |
101 | 101 | ||
102 | ---------------------------------------------------------------------------------- | 102 | ---------------------------------------------------------------------------------- |
103 | 103 | ||
@@ -164,8 +164,8 @@ minimizeConjugateGradient istep minimpar tol maxit f df xi = unsafePerformIO $ d | |||
164 | foreign import ccall "gsl-aux.h minimizeWithDeriv" | 164 | foreign import ccall "gsl-aux.h minimizeWithDeriv" |
165 | c_minimizeConjugateGradient :: FunPtr (Int -> Ptr Double -> Double) | 165 | c_minimizeConjugateGradient :: FunPtr (Int -> Ptr Double -> Double) |
166 | -> FunPtr (Int -> Ptr Double -> Ptr Double -> IO ()) | 166 | -> FunPtr (Int -> Ptr Double -> Ptr Double -> IO ()) |
167 | -> Double -> Double -> Double -> Int | 167 | -> Double -> Double -> Double -> Int |
168 | -> Double :> Double ::> IO Int | 168 | -> TVM -- Double :> Double ::> IO Int |
169 | 169 | ||
170 | --------------------------------------------------------------------- | 170 | --------------------------------------------------------------------- |
171 | iv :: (Vector Double -> Double) -> (Int -> Ptr Double -> Double) | 171 | iv :: (Vector Double -> Double) -> (Int -> Ptr Double -> Double) |
diff --git a/lib/GSL/Polynomials.hs b/lib/GSL/Polynomials.hs index d7db9a3..365c74e 100644 --- a/lib/GSL/Polynomials.hs +++ b/lib/GSL/Polynomials.hs | |||
@@ -51,4 +51,4 @@ polySolve' v | dim v > 1 = unsafePerformIO $ do | |||
51 | return r | 51 | return r |
52 | | otherwise = error "polySolve on a polynomial of degree zero" | 52 | | otherwise = error "polySolve on a polynomial of degree zero" |
53 | 53 | ||
54 | foreign import ccall "gsl-aux.h polySolve" c_polySolve:: Double :> Complex Double :> IO Int | 54 | foreign import ccall "gsl-aux.h polySolve" c_polySolve:: TVCV -- Double :> Complex Double :> IO Int |
diff --git a/lib/GSL/Vector.hs b/lib/GSL/Vector.hs index 3225139..fc80c16 100644 --- a/lib/GSL/Vector.hs +++ b/lib/GSL/Vector.hs | |||
@@ -122,7 +122,7 @@ toScalarR :: FunCodeS -> Vector Double -> Double | |||
122 | toScalarR oper = toScalarAux c_toScalarR (fromEnum oper) | 122 | toScalarR oper = toScalarAux c_toScalarR (fromEnum oper) |
123 | 123 | ||
124 | foreign import ccall safe "gsl-aux.h toScalarR" | 124 | foreign import ccall safe "gsl-aux.h toScalarR" |
125 | c_toScalarR :: Int -> Double :> Double :> IO Int | 125 | c_toScalarR :: Int -> TVV -- Double :> Double :> IO Int |
126 | 126 | ||
127 | ------------------------------------------------------------------ | 127 | ------------------------------------------------------------------ |
128 | 128 | ||
@@ -131,14 +131,14 @@ vectorMapR :: FunCodeV -> Vector Double -> Vector Double | |||
131 | vectorMapR = vectorMapAux c_vectorMapR | 131 | vectorMapR = vectorMapAux c_vectorMapR |
132 | 132 | ||
133 | foreign import ccall safe "gsl-aux.h mapR" | 133 | foreign import ccall safe "gsl-aux.h mapR" |
134 | c_vectorMapR :: Int -> Double :> Double :> IO Int | 134 | c_vectorMapR :: Int -> TVV -- Double :> Double :> IO Int |
135 | 135 | ||
136 | -- | map of complex vectors with given function | 136 | -- | map of complex vectors with given function |
137 | vectorMapC :: FunCodeV -> Vector (Complex Double) -> Vector (Complex Double) | 137 | vectorMapC :: FunCodeV -> Vector (Complex Double) -> Vector (Complex Double) |
138 | vectorMapC oper = vectorMapAux c_vectorMapC (fromEnum oper) | 138 | vectorMapC oper = vectorMapAux c_vectorMapC (fromEnum oper) |
139 | 139 | ||
140 | foreign import ccall safe "gsl-aux.h mapC" | 140 | foreign import ccall safe "gsl-aux.h mapC" |
141 | c_vectorMapC :: Int -> Complex Double :> Complex Double :> IO Int | 141 | c_vectorMapC :: Int -> TCVCV -- Complex Double :> Complex Double :> IO Int |
142 | 142 | ||
143 | ------------------------------------------------------------------- | 143 | ------------------------------------------------------------------- |
144 | 144 | ||
@@ -147,14 +147,14 @@ vectorMapValR :: FunCodeSV -> Double -> Vector Double -> Vector Double | |||
147 | vectorMapValR oper = vectorMapValAux c_vectorMapValR (fromEnum oper) | 147 | vectorMapValR oper = vectorMapValAux c_vectorMapValR (fromEnum oper) |
148 | 148 | ||
149 | foreign import ccall safe "gsl-aux.h mapValR" | 149 | foreign import ccall safe "gsl-aux.h mapValR" |
150 | c_vectorMapValR :: Int -> Ptr Double -> Double :> Double :> IO Int | 150 | c_vectorMapValR :: Int -> Ptr Double -> TVV -- Double :> Double :> IO Int |
151 | 151 | ||
152 | -- | map of complex vectors with given function | 152 | -- | map of complex vectors with given function |
153 | vectorMapValC :: FunCodeSV -> Complex Double -> Vector (Complex Double) -> Vector (Complex Double) | 153 | vectorMapValC :: FunCodeSV -> Complex Double -> Vector (Complex Double) -> Vector (Complex Double) |
154 | vectorMapValC = vectorMapValAux c_vectorMapValC | 154 | vectorMapValC = vectorMapValAux c_vectorMapValC |
155 | 155 | ||
156 | foreign import ccall safe "gsl-aux.h mapValC" | 156 | foreign import ccall safe "gsl-aux.h mapValC" |
157 | c_vectorMapValC :: Int -> Ptr (Complex Double) -> Complex Double :> Complex Double :> IO Int | 157 | c_vectorMapValC :: Int -> Ptr (Complex Double) -> TCVCV -- Complex Double :> Complex Double :> IO Int |
158 | 158 | ||
159 | ------------------------------------------------------------------- | 159 | ------------------------------------------------------------------- |
160 | 160 | ||
@@ -163,13 +163,13 @@ vectorZipR :: FunCodeVV -> Vector Double -> Vector Double -> Vector Double | |||
163 | vectorZipR = vectorZipAux c_vectorZipR | 163 | vectorZipR = vectorZipAux c_vectorZipR |
164 | 164 | ||
165 | foreign import ccall safe "gsl-aux.h zipR" | 165 | foreign import ccall safe "gsl-aux.h zipR" |
166 | c_vectorZipR :: Int -> Double :> Double :> Double :> IO Int | 166 | c_vectorZipR :: Int -> TVVV -- Double :> Double :> Double :> IO Int |
167 | 167 | ||
168 | -- | elementwise operation on complex vectors | 168 | -- | elementwise operation on complex vectors |
169 | vectorZipC :: FunCodeVV -> Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double) | 169 | vectorZipC :: FunCodeVV -> Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double) |
170 | vectorZipC = vectorZipAux c_vectorZipC | 170 | vectorZipC = vectorZipAux c_vectorZipC |
171 | 171 | ||
172 | foreign import ccall safe "gsl-aux.h zipC" | 172 | foreign import ccall safe "gsl-aux.h zipC" |
173 | c_vectorZipC :: Int -> Complex Double :> Complex Double :> Complex Double :> IO Int | 173 | c_vectorZipC :: Int -> TCVCVCV -- Complex Double :> Complex Double :> Complex Double :> IO Int |
174 | 174 | ||
175 | 175 | ||
diff --git a/lib/LAPACK.hs b/lib/LAPACK.hs index 1531cfb..dc9eda1 100644 --- a/lib/LAPACK.hs +++ b/lib/LAPACK.hs | |||
@@ -32,7 +32,7 @@ import Foreign | |||
32 | ----------------------------------------------------------------------------- | 32 | ----------------------------------------------------------------------------- |
33 | -- dgesvd | 33 | -- dgesvd |
34 | foreign import ccall "LAPACK/lapack-aux.h svd_l_R" | 34 | foreign import ccall "LAPACK/lapack-aux.h svd_l_R" |
35 | dgesvd :: Double ::> Double ::> (Double :> Double ::> IO Int) | 35 | dgesvd :: TMMVM -- Double ::> Double ::> (Double :> Double ::> IO Int) |
36 | 36 | ||
37 | -- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix. | 37 | -- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix. |
38 | -- | 38 | -- |
@@ -50,7 +50,7 @@ svdR' x@M {rows = r, cols = c} = unsafePerformIO $ do | |||
50 | ----------------------------------------------------------------------------- | 50 | ----------------------------------------------------------------------------- |
51 | -- dgesdd | 51 | -- dgesdd |
52 | foreign import ccall "LAPACK/lapack-aux.h svd_l_Rdd" | 52 | foreign import ccall "LAPACK/lapack-aux.h svd_l_Rdd" |
53 | dgesdd :: Double ::> Double ::> (Double :> Double ::> IO Int) | 53 | dgesdd :: TMMVM --Double ::> Double ::> (Double :> Double ::> IO Int) |
54 | 54 | ||
55 | -- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix. | 55 | -- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix. |
56 | -- | 56 | -- |
@@ -68,7 +68,7 @@ svdRdd' x@M {rows = r, cols = c} = unsafePerformIO $ do | |||
68 | ----------------------------------------------------------------------------- | 68 | ----------------------------------------------------------------------------- |
69 | -- zgesvd | 69 | -- zgesvd |
70 | foreign import ccall "LAPACK/lapack-aux.h svd_l_C" | 70 | foreign import ccall "LAPACK/lapack-aux.h svd_l_C" |
71 | zgesvd :: (Complex Double) ::> (Complex Double) ::> (Double :> (Complex Double) ::> IO Int) | 71 | zgesvd :: TCMCMVCM -- (Complex Double) ::> (Complex Double) ::> (Double :> (Complex Double) ::> IO Int) |
72 | 72 | ||
73 | -- | Wrapper for LAPACK's /zgesvd/, which computes the full svd decomposition of a complex matrix. | 73 | -- | Wrapper for LAPACK's /zgesvd/, which computes the full svd decomposition of a complex matrix. |
74 | -- | 74 | -- |
@@ -87,7 +87,7 @@ svdC' x@M {rows = r, cols = c} = unsafePerformIO $ do | |||
87 | ----------------------------------------------------------------------------- | 87 | ----------------------------------------------------------------------------- |
88 | -- zgeev | 88 | -- zgeev |
89 | foreign import ccall "LAPACK/lapack-aux.h eig_l_C" | 89 | foreign import ccall "LAPACK/lapack-aux.h eig_l_C" |
90 | zgeev :: (Complex Double) ::> (Complex Double) ::> ((Complex Double) :> (Complex Double) ::> IO Int) | 90 | zgeev :: TCMCMCVCM -- (Complex Double) ::> (Complex Double) ::> ((Complex Double) :> (Complex Double) ::> IO Int) |
91 | 91 | ||
92 | -- | Wrapper for LAPACK's /zgeev/, which computes the eigenvalues and right eigenvectors of a general complex matrix: | 92 | -- | Wrapper for LAPACK's /zgeev/, which computes the eigenvalues and right eigenvectors of a general complex matrix: |
93 | -- | 93 | -- |
@@ -108,7 +108,7 @@ eigC (m@M {rows = r}) | |||
108 | ----------------------------------------------------------------------------- | 108 | ----------------------------------------------------------------------------- |
109 | -- dgeev | 109 | -- dgeev |
110 | foreign import ccall "LAPACK/lapack-aux.h eig_l_R" | 110 | foreign import ccall "LAPACK/lapack-aux.h eig_l_R" |
111 | dgeev :: Double ::> Double ::> ((Complex Double) :> Double ::> IO Int) | 111 | dgeev :: TMMCVM -- Double ::> Double ::> ((Complex Double) :> Double ::> IO Int) |
112 | 112 | ||
113 | -- | Wrapper for LAPACK's /dgeev/, which computes the eigenvalues and right eigenvectors of a general real matrix: | 113 | -- | Wrapper for LAPACK's /dgeev/, which computes the eigenvalues and right eigenvectors of a general real matrix: |
114 | -- | 114 | -- |
@@ -144,7 +144,7 @@ scale r v = fromList [r] `outer` v | |||
144 | ----------------------------------------------------------------------------- | 144 | ----------------------------------------------------------------------------- |
145 | -- dsyev | 145 | -- dsyev |
146 | foreign import ccall "LAPACK/lapack-aux.h eig_l_S" | 146 | foreign import ccall "LAPACK/lapack-aux.h eig_l_S" |
147 | dsyev :: Double ::> (Double :> Double ::> IO Int) | 147 | dsyev :: TMVM -- Double ::> (Double :> Double ::> IO Int) |
148 | 148 | ||
149 | -- | Wrapper for LAPACK's /dsyev/, which computes the eigenvalues and right eigenvectors of a symmetric real matrix: | 149 | -- | Wrapper for LAPACK's /dsyev/, which computes the eigenvalues and right eigenvectors of a symmetric real matrix: |
150 | -- | 150 | -- |
@@ -168,7 +168,7 @@ eigS' (m@M {rows = r}) | |||
168 | ----------------------------------------------------------------------------- | 168 | ----------------------------------------------------------------------------- |
169 | -- zheev | 169 | -- zheev |
170 | foreign import ccall "LAPACK/lapack-aux.h eig_l_H" | 170 | foreign import ccall "LAPACK/lapack-aux.h eig_l_H" |
171 | zheev :: (Complex Double) ::> (Double :> (Complex Double) ::> IO Int) | 171 | zheev :: TCMVCM -- (Complex Double) ::> (Double :> (Complex Double) ::> IO Int) |
172 | 172 | ||
173 | -- | Wrapper for LAPACK's /zheev/, which computes the eigenvalues and right eigenvectors of a hermitian complex matrix: | 173 | -- | Wrapper for LAPACK's /zheev/, which computes the eigenvalues and right eigenvectors of a hermitian complex matrix: |
174 | -- | 174 | -- |
@@ -192,7 +192,7 @@ eigH' (m@M {rows = r}) | |||
192 | ----------------------------------------------------------------------------- | 192 | ----------------------------------------------------------------------------- |
193 | -- dgesv | 193 | -- dgesv |
194 | foreign import ccall "LAPACK/lapack-aux.h linearSolveR_l" | 194 | foreign import ccall "LAPACK/lapack-aux.h linearSolveR_l" |
195 | dgesv :: Double ::> Double ::> Double ::> IO Int | 195 | dgesv :: TMMM -- Double ::> Double ::> Double ::> IO Int |
196 | 196 | ||
197 | -- | Wrapper for LAPACK's /dgesv/, which solves a general real linear system (for several right-hand sides) internally using the lu decomposition. | 197 | -- | Wrapper for LAPACK's /dgesv/, which solves a general real linear system (for several right-hand sides) internally using the lu decomposition. |
198 | linearSolveR :: Matrix Double -> Matrix Double -> Matrix Double | 198 | linearSolveR :: Matrix Double -> Matrix Double -> Matrix Double |
@@ -206,7 +206,7 @@ linearSolveR a@(M {rows = n1, cols = n2}) b@(M {rows = r, cols = c}) | |||
206 | ----------------------------------------------------------------------------- | 206 | ----------------------------------------------------------------------------- |
207 | -- zgesv | 207 | -- zgesv |
208 | foreign import ccall "LAPACK/lapack-aux.h linearSolveC_l" | 208 | foreign import ccall "LAPACK/lapack-aux.h linearSolveC_l" |
209 | zgesv :: (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int | 209 | zgesv :: TCMCMCM -- (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int |
210 | 210 | ||
211 | -- | Wrapper for LAPACK's /zgesv/, which solves a general complex linear system (for several right-hand sides) internally using the lu decomposition. | 211 | -- | Wrapper for LAPACK's /zgesv/, which solves a general complex linear system (for several right-hand sides) internally using the lu decomposition. |
212 | linearSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | 212 | linearSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) |
@@ -220,7 +220,7 @@ linearSolveC a@(M {rows = n1, cols = n2}) b@(M {rows = r, cols = c}) | |||
220 | ----------------------------------------------------------------------------------- | 220 | ----------------------------------------------------------------------------------- |
221 | -- dgels | 221 | -- dgels |
222 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSR_l" | 222 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSR_l" |
223 | dgels :: Double ::> Double ::> Double ::> IO Int | 223 | dgels :: TMMM -- Double ::> Double ::> Double ::> IO Int |
224 | 224 | ||
225 | -- | Wrapper for LAPACK's /dgels/, which obtains the least squared error solution of an overconstrained real linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use 'linearSolveSVDR'. | 225 | -- | Wrapper for LAPACK's /dgels/, which obtains the least squared error solution of an overconstrained real linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use 'linearSolveSVDR'. |
226 | linearSolveLSR :: Matrix Double -> Matrix Double -> Matrix Double | 226 | linearSolveLSR :: Matrix Double -> Matrix Double -> Matrix Double |
@@ -234,7 +234,7 @@ linearSolveLSR_l a@(M {rows = m, cols = n}) b@(M {cols = nrhs}) = unsafePerformI | |||
234 | ----------------------------------------------------------------------------------- | 234 | ----------------------------------------------------------------------------------- |
235 | -- zgels | 235 | -- zgels |
236 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSC_l" | 236 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSC_l" |
237 | zgels :: (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int | 237 | zgels :: TCMCMCM -- (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int |
238 | 238 | ||
239 | -- | Wrapper for LAPACK's /zgels/, which obtains the least squared error solution of an overconstrained complex linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use 'linearSolveSVDC'. | 239 | -- | Wrapper for LAPACK's /zgels/, which obtains the least squared error solution of an overconstrained complex linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use 'linearSolveSVDC'. |
240 | linearSolveLSC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | 240 | linearSolveLSC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) |
@@ -248,7 +248,7 @@ linearSolveLSC_l a@(M {rows = m, cols = n}) b@(M {cols = nrhs}) = unsafePerformI | |||
248 | ----------------------------------------------------------------------------------- | 248 | ----------------------------------------------------------------------------------- |
249 | -- dgelss | 249 | -- dgelss |
250 | foreign import ccall "LAPACK/lapack-aux.h linearSolveSVDR_l" | 250 | foreign import ccall "LAPACK/lapack-aux.h linearSolveSVDR_l" |
251 | dgelss :: Double -> Double ::> Double ::> Double ::> IO Int | 251 | dgelss :: Double -> TMMM -- Double ::> Double ::> Double ::> IO Int |
252 | 252 | ||
253 | -- | Wrapper for LAPACK's /dgelss/, which obtains the minimum norm solution to a real linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than 'linearSolveLSR'. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. | 253 | -- | Wrapper for LAPACK's /dgelss/, which obtains the minimum norm solution to a real linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than 'linearSolveLSR'. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. |
254 | linearSolveSVDR :: Maybe Double -- ^ rcond | 254 | linearSolveSVDR :: Maybe Double -- ^ rcond |
@@ -266,7 +266,7 @@ linearSolveSVDR_l rcond a@(M {rows = m, cols = n}) b@(M {cols = nrhs}) = unsafeP | |||
266 | ----------------------------------------------------------------------------------- | 266 | ----------------------------------------------------------------------------------- |
267 | -- zgelss | 267 | -- zgelss |
268 | foreign import ccall "LAPACK/lapack-aux.h linearSolveSVDC_l" | 268 | foreign import ccall "LAPACK/lapack-aux.h linearSolveSVDC_l" |
269 | zgelss :: Double -> (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int | 269 | zgelss :: Double -> TCMCMCM -- (Complex Double) ::> (Complex Double) ::> (Complex Double) ::> IO Int |
270 | 270 | ||
271 | -- | Wrapper for LAPACK's /zgelss/, which obtains the minimum norm solution to a complex linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than 'linearSolveLSC'. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. | 271 | -- | Wrapper for LAPACK's /zgelss/, which obtains the minimum norm solution to a complex linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than 'linearSolveLSC'. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. |
272 | linearSolveSVDC :: Maybe Double -- ^ rcond | 272 | linearSolveSVDC :: Maybe Double -- ^ rcond |