diff options
Diffstat (limited to 'lib/Data/Packed')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 10 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Signatures.hs | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 9 |
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 | ||
268 | instance Element (Complex Float) where | ||
269 | transdata = transdataAux ctransQ | ||
270 | constantD = constantAux cconstantQ | ||
271 | |||
268 | instance Element (Complex Double) where | 272 | instance 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 | ||
315 | foreign import ccall "transF" ctransF :: TFMFM | 319 | foreign import ccall "transF" ctransF :: TFMFM |
316 | foreign import ccall "transR" ctransR :: TMM | 320 | foreign import ccall "transR" ctransR :: TMM |
321 | foreign import ccall "transQ" ctransQ :: TQMQM | ||
317 | foreign import ccall "transC" ctransC :: TCMCM | 322 | foreign import ccall "transC" ctransC :: TCMCM |
318 | ---------------------------------------------------------------------- | 323 | ---------------------------------------------------------------------- |
319 | 324 | ||
@@ -342,9 +347,14 @@ constantR :: Double -> Int -> Vector Double | |||
342 | constantR = constantAux cconstantR | 347 | constantR = constantAux cconstantR |
343 | foreign import ccall "constantR" cconstantR :: Ptr Double -> TV | 348 | foreign import ccall "constantR" cconstantR :: Ptr Double -> TV |
344 | 349 | ||
350 | constantQ :: Complex Float -> Int -> Vector (Complex Float) | ||
351 | constantQ = constantAux cconstantQ | ||
352 | foreign import ccall "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV | ||
353 | |||
345 | constantC :: Complex Double -> Int -> Vector (Complex Double) | 354 | constantC :: Complex Double -> Int -> Vector (Complex Double) |
346 | constantC = constantAux cconstantC | 355 | constantC = constantAux cconstantC |
347 | foreign import ccall "constantC" cconstantC :: Ptr (Complex Double) -> TCV | 356 | foreign 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 -- | |||
59 | type TQVQV = CInt -> PQ -> TQV -- | 59 | type TQVQV = CInt -> PQ -> TQV -- |
60 | type TQVQVQV = CInt -> PQ -> TQVQV -- | 60 | type TQVQVQV = CInt -> PQ -> TQVQV -- |
61 | type TQVF = CInt -> PQ -> TF -- | 61 | type TQVF = CInt -> PQ -> TF -- |
62 | type TQM = CInt -> CInt -> PQ -> IO CInt -- | ||
63 | type TQMQM = CInt -> CInt -> PQ -> TQM -- | ||
62 | type TCMCV = CInt -> CInt -> PC -> TCV -- | 64 | type TCMCV = CInt -> CInt -> PC -> TCV -- |
63 | type TVCV = CInt -> PD -> TCV -- | 65 | type TVCV = CInt -> PD -> TCV -- |
64 | type TCVM = CInt -> PC -> TM -- | 66 | type 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 | ||
475 | instance 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 | |||
474 | instance Container Vector (Complex Double) where | 483 | instance Container Vector (Complex Double) where |
475 | toComplex = undefined -- can't match | 484 | toComplex = undefined -- can't match |
476 | fromComplex = undefined | 485 | fromComplex = undefined |