summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-08 23:03:48 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-08 23:03:48 +0000
commit97e8a48be58fd53afccc7ae01ee6ec5805d5c1cd (patch)
tree837f4a6b21e0317da834c8ac42c8adfce9a22d24 /lib/Data
parentb8699c4f1acff1e3f31cdbac1a7a4a8864b1eeba (diff)
Linear and Floating (Complex Float)
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs10
-rw-r--r--lib/Data/Packed/Internal/Signatures.hs2
-rw-r--r--lib/Data/Packed/Matrix.hs9
3 files changed, 21 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 7b3b305..861c72a 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -265,6 +265,10 @@ instance Element Double where
265 transdata = transdataAux ctransR 265 transdata = transdataAux ctransR
266 constantD = constantAux cconstantR 266 constantD = constantAux cconstantR
267 267
268instance Element (Complex Float) where
269 transdata = transdataAux ctransQ
270 constantD = constantAux cconstantQ
271
268instance Element (Complex Double) where 272instance Element (Complex Double) where
269 transdata = transdataAux ctransC 273 transdata = transdataAux ctransC
270 constantD = constantAux cconstantC 274 constantD = constantAux cconstantC
@@ -314,6 +318,7 @@ transdataAux fun c1 d c2 =
314 318
315foreign import ccall "transF" ctransF :: TFMFM 319foreign import ccall "transF" ctransF :: TFMFM
316foreign import ccall "transR" ctransR :: TMM 320foreign import ccall "transR" ctransR :: TMM
321foreign import ccall "transQ" ctransQ :: TQMQM
317foreign import ccall "transC" ctransC :: TCMCM 322foreign import ccall "transC" ctransC :: TCMCM
318---------------------------------------------------------------------- 323----------------------------------------------------------------------
319 324
@@ -342,9 +347,14 @@ constantR :: Double -> Int -> Vector Double
342constantR = constantAux cconstantR 347constantR = constantAux cconstantR
343foreign import ccall "constantR" cconstantR :: Ptr Double -> TV 348foreign import ccall "constantR" cconstantR :: Ptr Double -> TV
344 349
350constantQ :: Complex Float -> Int -> Vector (Complex Float)
351constantQ = constantAux cconstantQ
352foreign import ccall "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV
353
345constantC :: Complex Double -> Int -> Vector (Complex Double) 354constantC :: Complex Double -> Int -> Vector (Complex Double)
346constantC = constantAux cconstantC 355constantC = constantAux cconstantC
347foreign import ccall "constantC" cconstantC :: Ptr (Complex Double) -> TCV 356foreign import ccall "constantC" cconstantC :: Ptr (Complex Double) -> TCV
357
348---------------------------------------------------------------------- 358----------------------------------------------------------------------
349 359
350-- | Extracts a submatrix from a matrix. 360-- | Extracts a submatrix from a matrix.
diff --git a/lib/Data/Packed/Internal/Signatures.hs b/lib/Data/Packed/Internal/Signatures.hs
index 78d00fa..8c1c5f6 100644
--- a/lib/Data/Packed/Internal/Signatures.hs
+++ b/lib/Data/Packed/Internal/Signatures.hs
@@ -59,6 +59,8 @@ type TQV = CInt -> PQ -> IO CInt --
59type TQVQV = CInt -> PQ -> TQV -- 59type TQVQV = CInt -> PQ -> TQV --
60type TQVQVQV = CInt -> PQ -> TQVQV -- 60type TQVQVQV = CInt -> PQ -> TQVQV --
61type TQVF = CInt -> PQ -> TF -- 61type TQVF = CInt -> PQ -> TF --
62type TQM = CInt -> CInt -> PQ -> IO CInt --
63type TQMQM = CInt -> CInt -> PQ -> TQM --
62type TCMCV = CInt -> CInt -> PC -> TCV -- 64type TCMCV = CInt -> CInt -> PC -> TCV --
63type TVCV = CInt -> PD -> TCV -- 65type TVCV = CInt -> PD -> TCV --
64type TCVM = CInt -> PC -> TM -- 66type TCVM = CInt -> PC -> TM --
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index c6d8a90..e7ee781 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -452,6 +452,7 @@ class (Element e) => Container c e where
452 fromComplex :: RealFloat e => c (Complex e) -> (c e, c e) 452 fromComplex :: RealFloat e => c (Complex e) -> (c e, c e)
453 comp :: RealFloat e => c e -> c (Complex e) 453 comp :: RealFloat e => c e -> c (Complex e)
454 conj :: RealFloat e => c (Complex e) -> c (Complex e) 454 conj :: RealFloat e => c (Complex e) -> c (Complex e)
455 -- these next two are now weird given we have Floats as well
455 real :: c Double -> c e 456 real :: c Double -> c e
456 complex :: c e -> c (Complex Double) 457 complex :: c e -> c (Complex Double)
457 458
@@ -471,6 +472,14 @@ instance Container Vector Double where
471 real = id 472 real = id
472 complex = comp 473 complex = comp
473 474
475instance Container Vector (Complex Float) where
476 toComplex = undefined -- can't match
477 fromComplex = undefined
478 comp = undefined
479 conj = undefined
480 real = comp . mapVector realToFrac
481 complex = mapVector (\(r :+ i) -> realToFrac r :+ realToFrac i)
482
474instance Container Vector (Complex Double) where 483instance Container Vector (Complex Double) where
475 toComplex = undefined -- can't match 484 toComplex = undefined -- can't match
476 fromComplex = undefined 485 fromComplex = undefined