diff options
Diffstat (limited to 'lib/Data/Packed/Vector.hs')
-rw-r--r-- | lib/Data/Packed/Vector.hs | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 8d1c8b6..992301a 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs | |||
@@ -1 +1,40 @@ | |||
1 | 1 | ----------------------------------------------------------------------------- | |
2 | -- | | ||
3 | -- Module : Data.Packed.Vector | ||
4 | -- Copyright : (c) Alberto Ruiz 2007 | ||
5 | -- License : GPL-style | ||
6 | -- | ||
7 | -- Maintainer : Alberto Ruiz <aruiz@um.es> | ||
8 | -- Stability : provisional | ||
9 | -- Portability : portable | ||
10 | -- | ||
11 | -- Vectors | ||
12 | -- | ||
13 | ----------------------------------------------------------------------------- | ||
14 | |||
15 | module Data.Packed.Vector ( | ||
16 | Vector(dim), Field, | ||
17 | fromList, toList, | ||
18 | at, | ||
19 | subVector, join, | ||
20 | constant, | ||
21 | toComplex, comp, | ||
22 | conj, | ||
23 | dot | ||
24 | ) where | ||
25 | |||
26 | import Data.Packed.Internal | ||
27 | import Complex | ||
28 | |||
29 | -- | creates a complex vector from vectors with real and imaginary parts | ||
30 | toComplex :: (Vector Double, Vector Double) -> Vector (Complex Double) | ||
31 | toComplex (r,i) = asComplex $ cdat $ fromColumns [r,i] | ||
32 | |||
33 | -- | obtains the complex conjugate of a complex vector | ||
34 | conj :: Vector (Complex Double) -> Vector (Complex Double) | ||
35 | conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1]) | ||
36 | where mulC = multiply RowMajor | ||
37 | |||
38 | comp v = toComplex (v,constant (dim v) 0) | ||
39 | |||
40 | |||