diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 3 | ||||
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 4 | ||||
-rw-r--r-- | lib/Numeric/Container.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | 4 | ||||
-rw-r--r-- | lib/Numeric/Matrix.hs | 2 |
5 files changed, 10 insertions, 5 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 090826d..c0824a3 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -246,7 +246,8 @@ compat m1 m2 = rows m1 == rows m2 && cols m1 == cols m2 | |||
246 | ------------------------------------------------------------------ | 246 | ------------------------------------------------------------------ |
247 | 247 | ||
248 | -- | Supported element types for basic matrix operations. | 248 | -- | Supported element types for basic matrix operations. |
249 | class (Storable a, Floating a) => Element a where | 249 | --class (Storable a, Floating a) => Element a where |
250 | class (Storable a) => Element a where | ||
250 | subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position | 251 | subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position |
251 | -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix | 252 | -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix |
252 | -> Matrix a -> Matrix a | 253 | -> Matrix a -> Matrix a |
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 0fc7876..b8c309c 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs | |||
@@ -170,7 +170,7 @@ fliprl m = fromColumns . reverse . toColumns $ m | |||
170 | ------------------------------------------------------------ | 170 | ------------------------------------------------------------ |
171 | 171 | ||
172 | -- | Creates a square matrix with a given diagonal. | 172 | -- | Creates a square matrix with a given diagonal. |
173 | diag :: Element a => Vector a -> Matrix a | 173 | diag :: (Num a, Element a) => Vector a -> Matrix a |
174 | diag v = ST.runSTMatrix $ do | 174 | diag v = ST.runSTMatrix $ do |
175 | let d = dim v | 175 | let d = dim v |
176 | m <- ST.newMatrix 0 d d | 176 | m <- ST.newMatrix 0 d d |
@@ -199,7 +199,7 @@ takeDiag :: (Element t) => Matrix t -> Vector t | |||
199 | takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] | 199 | takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] |
200 | 200 | ||
201 | -- | creates the identity matrix of given dimension | 201 | -- | creates the identity matrix of given dimension |
202 | ident :: Element a => Int -> Matrix a | 202 | ident :: (Num a, Element a) => Int -> Matrix a |
203 | ident n = diag (constantD 1 n) | 203 | ident n = diag (constantD 1 n) |
204 | 204 | ||
205 | ------------------------------------------------------------ | 205 | ------------------------------------------------------------ |
diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs index 8cf3e07..83bf44e 100644 --- a/lib/Numeric/Container.hs +++ b/lib/Numeric/Container.hs | |||
@@ -62,7 +62,7 @@ type instance IndexOf Matrix = (Int,Int) | |||
62 | ------------------------------------------------------------------- | 62 | ------------------------------------------------------------------- |
63 | 63 | ||
64 | -- | Basic element-by-element functions for numeric containers | 64 | -- | Basic element-by-element functions for numeric containers |
65 | class (Complexable c, Element e) => Container c e where | 65 | class (Complexable c, Fractional e, Element e) => Container c e where |
66 | -- | create a structure with a single element | 66 | -- | create a structure with a single element |
67 | scalar :: e -> c e | 67 | scalar :: e -> c e |
68 | -- | complex conjugate | 68 | -- | complex conjugate |
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h index 12dcde4..0543f7a 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | |||
@@ -64,18 +64,22 @@ typedef short ftnlen; | |||
64 | 64 | ||
65 | /********************************************************/ | 65 | /********************************************************/ |
66 | 66 | ||
67 | int multiplyF(int ta, int tb, KFMAT(a),KFMAT(b),FMAT(r)); | ||
67 | int multiplyR(int ta, int tb, KDMAT(a),KDMAT(b),DMAT(r)); | 68 | int multiplyR(int ta, int tb, KDMAT(a),KDMAT(b),DMAT(r)); |
68 | int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)); | 69 | int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)); |
70 | int multiplyQ(int ta, int tb, KQMAT(a),KQMAT(b),QMAT(r)); | ||
69 | 71 | ||
70 | int transF(KFMAT(x),FMAT(t)); | 72 | int transF(KFMAT(x),FMAT(t)); |
71 | int transR(KDMAT(x),DMAT(t)); | 73 | int transR(KDMAT(x),DMAT(t)); |
72 | int transQ(KQMAT(x),QMAT(t)); | 74 | int transQ(KQMAT(x),QMAT(t)); |
73 | int transC(KCMAT(x),CMAT(t)); | 75 | int transC(KCMAT(x),CMAT(t)); |
76 | int transP(KPMAT(x),PMAT(t)); | ||
74 | 77 | ||
75 | int constantF(float * pval, FVEC(r)); | 78 | int constantF(float * pval, FVEC(r)); |
76 | int constantR(double * pval, DVEC(r)); | 79 | int constantR(double * pval, DVEC(r)); |
77 | int constantQ(complex* pval, QVEC(r)); | 80 | int constantQ(complex* pval, QVEC(r)); |
78 | int constantC(doublecomplex* pval, CVEC(r)); | 81 | int constantC(doublecomplex* pval, CVEC(r)); |
82 | int constantP(void* pval, PVEC(r)); | ||
79 | 83 | ||
80 | int float2double(FVEC(x),DVEC(y)); | 84 | int float2double(FVEC(x),DVEC(y)); |
81 | int double2float(DVEC(x),FVEC(y)); | 85 | int double2float(DVEC(x),FVEC(y)); |
diff --git a/lib/Numeric/Matrix.hs b/lib/Numeric/Matrix.hs index f78e0c2..d5c6f44 100644 --- a/lib/Numeric/Matrix.hs +++ b/lib/Numeric/Matrix.hs | |||
@@ -63,7 +63,7 @@ instance (Container Vector a, Fractional (Vector a), Num (Matrix a)) => Fraction | |||
63 | 63 | ||
64 | --------------------------------------------------------- | 64 | --------------------------------------------------------- |
65 | 65 | ||
66 | instance (Container Vector a, Floating (Vector a), Fractional (Matrix a)) => Floating (Matrix a) where | 66 | instance (Floating a, Container Vector a, Floating (Vector a), Fractional (Matrix a)) => Floating (Matrix a) where |
67 | sin = liftMatrix sin | 67 | sin = liftMatrix sin |
68 | cos = liftMatrix cos | 68 | cos = liftMatrix cos |
69 | tan = liftMatrix tan | 69 | tan = liftMatrix tan |