From 713d4056abb2e786b4084e7e220d359b06dcaf1f Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 13 Jun 2007 16:35:02 +0000 Subject: refactoring --- lib/Data/Packed/Vector.hs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'lib/Data/Packed/Vector.hs') 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 @@ - +----------------------------------------------------------------------------- +-- | +-- Module : Data.Packed.Vector +-- Copyright : (c) Alberto Ruiz 2007 +-- License : GPL-style +-- +-- Maintainer : Alberto Ruiz +-- Stability : provisional +-- Portability : portable +-- +-- Vectors +-- +----------------------------------------------------------------------------- + +module Data.Packed.Vector ( + Vector(dim), Field, + fromList, toList, + at, + subVector, join, + constant, + toComplex, comp, + conj, + dot +) where + +import Data.Packed.Internal +import Complex + +-- | creates a complex vector from vectors with real and imaginary parts +toComplex :: (Vector Double, Vector Double) -> Vector (Complex Double) +toComplex (r,i) = asComplex $ cdat $ fromColumns [r,i] + +-- | obtains the complex conjugate of a complex vector +conj :: Vector (Complex Double) -> Vector (Complex Double) +conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1]) + where mulC = multiply RowMajor + +comp v = toComplex (v,constant (dim v) 0) + + -- cgit v1.2.3