From 482b533c3fbfcd75d6c5c1d3ce32585bf9fc2ad7 Mon Sep 17 00:00:00 2001 From: Vivian McPhail Date: Mon, 20 Sep 2010 03:48:46 +0000 Subject: remove Fractional from Element --- lib/Data/Packed/Internal/Matrix.hs | 3 ++- lib/Data/Packed/Matrix.hs | 4 ++-- lib/Numeric/Container.hs | 2 +- lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | 4 ++++ lib/Numeric/Matrix.hs | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) (limited to 'lib') 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 ------------------------------------------------------------------ -- | Supported element types for basic matrix operations. -class (Storable a, Floating a) => Element a where +--class (Storable a, Floating a) => Element a where +class (Storable a) => Element a where subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix -> 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 ------------------------------------------------------------ -- | Creates a square matrix with a given diagonal. -diag :: Element a => Vector a -> Matrix a +diag :: (Num a, Element a) => Vector a -> Matrix a diag v = ST.runSTMatrix $ do let d = dim v m <- ST.newMatrix 0 d d @@ -199,7 +199,7 @@ takeDiag :: (Element t) => Matrix t -> Vector t takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] -- | creates the identity matrix of given dimension -ident :: Element a => Int -> Matrix a +ident :: (Num a, Element a) => Int -> Matrix a ident n = diag (constantD 1 n) ------------------------------------------------------------ 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) ------------------------------------------------------------------- -- | Basic element-by-element functions for numeric containers -class (Complexable c, Element e) => Container c e where +class (Complexable c, Fractional e, Element e) => Container c e where -- | create a structure with a single element scalar :: e -> c e -- | 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; /********************************************************/ +int multiplyF(int ta, int tb, KFMAT(a),KFMAT(b),FMAT(r)); int multiplyR(int ta, int tb, KDMAT(a),KDMAT(b),DMAT(r)); int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)); +int multiplyQ(int ta, int tb, KQMAT(a),KQMAT(b),QMAT(r)); int transF(KFMAT(x),FMAT(t)); int transR(KDMAT(x),DMAT(t)); int transQ(KQMAT(x),QMAT(t)); int transC(KCMAT(x),CMAT(t)); +int transP(KPMAT(x),PMAT(t)); int constantF(float * pval, FVEC(r)); int constantR(double * pval, DVEC(r)); int constantQ(complex* pval, QVEC(r)); int constantC(doublecomplex* pval, CVEC(r)); +int constantP(void* pval, PVEC(r)); int float2double(FVEC(x),DVEC(y)); 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 --------------------------------------------------------- -instance (Container Vector a, Floating (Vector a), Fractional (Matrix a)) => Floating (Matrix a) where +instance (Floating a, Container Vector a, Floating (Vector a), Fractional (Matrix a)) => Floating (Matrix a) where sin = liftMatrix sin cos = liftMatrix cos tan = liftMatrix tan -- cgit v1.2.3