summaryrefslogtreecommitdiff
path: root/lib/Numeric/Conversion.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-09-11 09:10:24 +0000
committerAlberto Ruiz <aruiz@um.es>2010-09-11 09:10:24 +0000
commitec9965371be5b37234684ba392f55a1a1e24f053 (patch)
treefae00b984fc8499e19952200f1b3f9f7ee5f2d20 /lib/Numeric/Conversion.hs
parentae6d18808cef554979b99cc55f46d5324518df01 (diff)
optimized conjugate
Diffstat (limited to 'lib/Numeric/Conversion.hs')
-rw-r--r--lib/Numeric/Conversion.hs9
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/Numeric/Conversion.hs b/lib/Numeric/Conversion.hs
index b05069c..809ac51 100644
--- a/lib/Numeric/Conversion.hs
+++ b/lib/Numeric/Conversion.hs
@@ -69,7 +69,6 @@ class ComplexContainer c where
69 fromComplex :: (RealElement e) => c (Complex e) -> (c e, c e) 69 fromComplex :: (RealElement e) => c (Complex e) -> (c e, c e)
70 comp :: (RealElement e) => c e -> c (Complex e) 70 comp :: (RealElement e) => c e -> c (Complex e)
71 conj :: (RealElement e) => c (Complex e) -> c (Complex e) 71 conj :: (RealElement e) => c (Complex e) -> c (Complex e)
72-- cmap :: (Element a, Element b) => (a -> b) -> c a -> c b
73 single' :: Precision a b => c b -> c a 72 single' :: Precision a b => c b -> c a
74 double' :: Precision a b => c a -> c b 73 double' :: Precision a b => c a -> c b
75 74
@@ -78,16 +77,11 @@ instance ComplexContainer Vector where
78 toComplex = toComplexV 77 toComplex = toComplexV
79 fromComplex = fromComplexV 78 fromComplex = fromComplexV
80 comp v = toComplex (v,constantD 0 (dim v)) 79 comp v = toComplex (v,constantD 0 (dim v))
81 conj = conjV 80 conj = conjugateD
82-- cmap = mapVector
83 single' = double2FloatG 81 single' = double2FloatG
84 double' = float2DoubleG 82 double' = float2DoubleG
85 83
86 84
87-- | obtains the complex conjugate of a complex vector
88conjV :: (RealElement a) => Vector (Complex a) -> Vector (Complex a)
89conjV = mapVector conjugate
90
91-- | creates a complex vector from vectors with real and imaginary parts 85-- | creates a complex vector from vectors with real and imaginary parts
92toComplexV :: (RealElement a) => (Vector a, Vector a) -> Vector (Complex a) 86toComplexV :: (RealElement a) => (Vector a, Vector a) -> Vector (Complex a)
93toComplexV (r,i) = asComplex $ flatten $ fromColumns [r,i] 87toComplexV (r,i) = asComplex $ flatten $ fromColumns [r,i]
@@ -104,7 +98,6 @@ instance ComplexContainer Matrix where
104 where c = cols z 98 where c = cols z
105 comp = liftMatrix comp 99 comp = liftMatrix comp
106 conj = liftMatrix conj 100 conj = liftMatrix conj
107-- cmap f = liftMatrix (cmap f)
108 single' = liftMatrix single' 101 single' = liftMatrix single'
109 double' = liftMatrix double' 102 double' = liftMatrix double'
110 103