summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Matrix.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal/Matrix.hs')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 89a162a..58b325c 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -348,7 +348,7 @@ foreign import ccall safe "aux.h constantC"
348@> constant 2 7 348@> constant 2 7
3497 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0]@ 3497 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0]@
350-} 350-}
351constant :: Field a => a -> Int -> Vector a 351constant :: Double -> Int -> Vector Double
352constant = constantD 352constant = constantD
353 353
354-------------------------------------------------------------------------- 354--------------------------------------------------------------------------
@@ -361,6 +361,11 @@ conj v = asComplex $ cdat $ reshape 2 (asReal v) `multiply` diag (fromList [1,-1
361toComplex :: (Vector Double, Vector Double) -> Vector (Complex Double) 361toComplex :: (Vector Double, Vector Double) -> Vector (Complex Double)
362toComplex (r,i) = asComplex $ cdat $ fromColumns [r,i] 362toComplex (r,i) = asComplex $ cdat $ fromColumns [r,i]
363 363
364-- | the inverse of 'toComplex'
365fromComplex :: Vector (Complex Double) -> (Vector Double, Vector Double)
366fromComplex z = (r,i) where
367 [r,i] = toColumns $ reshape 2 $ asReal z
368
364-- | converts a real vector into a complex representation (with zero imaginary parts) 369-- | converts a real vector into a complex representation (with zero imaginary parts)
365comp :: Vector Double -> Vector (Complex Double) 370comp :: Vector Double -> Vector (Complex Double)
366comp v = toComplex (v,constant 0 (dim v)) 371comp v = toComplex (v,constant 0 (dim v))