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, 7 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index b8de245..bae56f1 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -190,6 +190,8 @@ conj :: Vector (Complex Double) -> Vector (Complex Double)
190conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1]) 190conj v = asComplex $ cdat $ reshape 2 (asReal v) `mulC` diag (fromList [1,-1])
191 where mulC = multiply RowMajor 191 where mulC = multiply RowMajor
192 192
193comp v = toComplex (v,constant (dim v) 0)
194
193------------------------------------------------------------------------------ 195------------------------------------------------------------------------------
194 196
195-- | Reverse rows 197-- | Reverse rows
@@ -203,6 +205,7 @@ fliprl m = fromColumns . reverse . toColumns $ m
203----------------------------------------------------------------- 205-----------------------------------------------------------------
204 206
205liftMatrix f m = m { dat = f (dat m), tdat = f (tdat m) } -- check sizes 207liftMatrix f m = m { dat = f (dat m), tdat = f (tdat m) } -- check sizes
208liftMatrix2 f m1 m2 = reshape (cols m1) (f (cdat m1) (cdat m2)) -- check sizes
206 209
207------------------------------------------------------------------ 210------------------------------------------------------------------
208 211
@@ -333,3 +336,7 @@ diagRect s r c
333 | r < c = trans $ diagRect s c r 336 | r < c = trans $ diagRect s c r
334 | r > c = joinVert [diag s , zeros (r-c,c)] 337 | r > c = joinVert [diag s , zeros (r-c,c)]
335 where zeros (r,c) = reshape c $ constant (r*c) 0 338 where zeros (r,c) = reshape c $ constant (r*c) 0
339
340takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]]
341
342ident n = diag (constant n 1)