summaryrefslogtreecommitdiff
path: root/lib/Data/Packed.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed.hs')
-rw-r--r--lib/Data/Packed.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Data/Packed.hs b/lib/Data/Packed.hs
index bb25c26..7d6d200 100644
--- a/lib/Data/Packed.hs
+++ b/lib/Data/Packed.hs
@@ -24,7 +24,7 @@ module Data.Packed (
24import Data.Packed.Vector 24import Data.Packed.Vector
25import Data.Packed.Matrix 25import Data.Packed.Matrix
26import Data.Complex 26import Data.Complex
27import Data.Packed.Internal(fromComplex,toComplex,comp,conj) 27import Data.Packed.Internal(fromComplex,toComplex,conj)
28 28
29-- | conversion utilities 29-- | conversion utilities
30class (Element e) => Container c e where 30class (Element e) => Container c e where
@@ -38,7 +38,7 @@ class (Element e) => Container c e where
38instance Container Vector Double where 38instance Container Vector Double where
39 toComplex = Data.Packed.Internal.toComplex 39 toComplex = Data.Packed.Internal.toComplex
40 fromComplex = Data.Packed.Internal.fromComplex 40 fromComplex = Data.Packed.Internal.fromComplex
41 comp = Data.Packed.Internal.comp 41 comp = internalcomp
42 conj = Data.Packed.Internal.conj 42 conj = Data.Packed.Internal.conj
43 real = id 43 real = id
44 complex = Data.Packed.comp 44 complex = Data.Packed.comp
@@ -56,7 +56,7 @@ instance Container Matrix Double where
56 fromComplex z = (reshape c r, reshape c i) 56 fromComplex z = (reshape c r, reshape c i)
57 where (r,i) = Data.Packed.fromComplex (flatten z) 57 where (r,i) = Data.Packed.fromComplex (flatten z)
58 c = cols z 58 c = cols z
59 comp = liftMatrix Data.Packed.Internal.comp 59 comp = liftMatrix internalcomp
60 conj = liftMatrix Data.Packed.Internal.conj 60 conj = liftMatrix Data.Packed.Internal.conj
61 real = id 61 real = id
62 complex = Data.Packed.comp 62 complex = Data.Packed.comp
@@ -68,3 +68,8 @@ instance Container Matrix (Complex Double) where
68 conj = undefined 68 conj = undefined
69 real = Data.Packed.comp 69 real = Data.Packed.comp
70 complex = id 70 complex = id
71
72
73-- | converts a real vector into a complex representation (with zero imaginary parts)
74internalcomp :: Vector Double -> Vector (Complex Double)
75internalcomp v = Data.Packed.Internal.toComplex (v,constant 0 (dim v))