summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Vector.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-06-22 17:33:17 +0000
committerAlberto Ruiz <aruiz@um.es>2007-06-22 17:33:17 +0000
commit978e6d038239af50d70bae2c303f4e45b1879b7a (patch)
tree571b2060f388d0693820f808b40089acb100a5d9 /lib/Data/Packed/Vector.hs
parent989bdf7e88c13500bd1986dcde36f6cc4f467efb (diff)
refactoring
Diffstat (limited to 'lib/Data/Packed/Vector.hs')
-rw-r--r--lib/Data/Packed/Vector.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs
index 992301a..aa1b489 100644
--- a/lib/Data/Packed/Vector.hs
+++ b/lib/Data/Packed/Vector.hs
@@ -20,7 +20,8 @@ module Data.Packed.Vector (
20 constant, 20 constant,
21 toComplex, comp, 21 toComplex, comp,
22 conj, 22 conj,
23 dot 23 dot,
24 linspace
24) where 25) where
25 26
26import Data.Packed.Internal 27import Data.Packed.Internal
@@ -35,6 +36,14 @@ conj :: Vector (Complex Double) -> Vector (Complex Double)
35conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1]) 36conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1])
36 where mulC = multiply RowMajor 37 where mulC = multiply RowMajor
37 38
38comp v = toComplex (v,constant (dim v) 0) 39comp v = toComplex (v,constant 0 (dim v))
39 40
41{- | Creates a real vector containing a range of values:
40 42
43> > linspace 10 (-2,2)
44>-2. -1.556 -1.111 -0.667 -0.222 0.222 0.667 1.111 1.556 2.
45
46-}
47linspace :: Int -> (Double, Double) -> Vector Double
48linspace n (a,b) = fromList [a::Double,a+delta .. b]
49 where delta = (b-a)/(fromIntegral n -1)