summaryrefslogtreecommitdiff
path: root/lib/Data/Packed.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-01-16 18:17:53 +0000
committerAlberto Ruiz <aruiz@um.es>2010-01-16 18:17:53 +0000
commit3fb3a81e63540497a81b717c615f711ce031c76f (patch)
treea2f4b09636df3ca904b328b35c140ab4c22be093 /lib/Data/Packed.hs
parentb8b9e8a91b51e6689a071dbc05f3da857c762e0d (diff)
vecdisp, scalar, docs
Diffstat (limited to 'lib/Data/Packed.hs')
-rw-r--r--lib/Data/Packed.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Data/Packed.hs b/lib/Data/Packed.hs
index 7d6d200..7ffdd0b 100644
--- a/lib/Data/Packed.hs
+++ b/lib/Data/Packed.hs
@@ -34,6 +34,7 @@ class (Element e) => Container c e where
34 conj :: RealFloat e => c (Complex e) -> c (Complex e) 34 conj :: RealFloat e => c (Complex e) -> c (Complex e)
35 real :: c Double -> c e 35 real :: c Double -> c e
36 complex :: c e -> c (Complex Double) 36 complex :: c e -> c (Complex Double)
37 scalar :: e -> c e
37 38
38instance Container Vector Double where 39instance Container Vector Double where
39 toComplex = Data.Packed.Internal.toComplex 40 toComplex = Data.Packed.Internal.toComplex
@@ -42,6 +43,7 @@ instance Container Vector Double where
42 conj = Data.Packed.Internal.conj 43 conj = Data.Packed.Internal.conj
43 real = id 44 real = id
44 complex = Data.Packed.comp 45 complex = Data.Packed.comp
46 scalar x = fromList [x]
45 47
46instance Container Vector (Complex Double) where 48instance Container Vector (Complex Double) where
47 toComplex = undefined -- can't match 49 toComplex = undefined -- can't match
@@ -50,6 +52,7 @@ instance Container Vector (Complex Double) where
50 conj = undefined 52 conj = undefined
51 real = Data.Packed.comp 53 real = Data.Packed.comp
52 complex = id 54 complex = id
55 scalar x = fromList [x]
53 56
54instance Container Matrix Double where 57instance Container Matrix Double where
55 toComplex = uncurry $ liftMatrix2 $ curry Data.Packed.toComplex 58 toComplex = uncurry $ liftMatrix2 $ curry Data.Packed.toComplex
@@ -60,6 +63,7 @@ instance Container Matrix Double where
60 conj = liftMatrix Data.Packed.Internal.conj 63 conj = liftMatrix Data.Packed.Internal.conj
61 real = id 64 real = id
62 complex = Data.Packed.comp 65 complex = Data.Packed.comp
66 scalar x = (1><1) [x]
63 67
64instance Container Matrix (Complex Double) where 68instance Container Matrix (Complex Double) where
65 toComplex = undefined 69 toComplex = undefined
@@ -68,6 +72,7 @@ instance Container Matrix (Complex Double) where
68 conj = undefined 72 conj = undefined
69 real = Data.Packed.comp 73 real = Data.Packed.comp
70 complex = id 74 complex = id
75 scalar x = (1><1) [x]
71 76
72 77
73-- | converts a real vector into a complex representation (with zero imaginary parts) 78-- | converts a real vector into a complex representation (with zero imaginary parts)