From 473df6136476dfa07331dd25a6020260c4f02a9b Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 11 Jun 2007 10:46:39 +0000 Subject: all eig --- lib/Data/Packed/Internal/Matrix.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Data') 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) 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) + ------------------------------------------------------------------------------ -- | Reverse rows @@ -203,6 +205,7 @@ fliprl m = fromColumns . reverse . toColumns $ m ----------------------------------------------------------------- liftMatrix f m = m { dat = f (dat m), tdat = f (tdat m) } -- check sizes +liftMatrix2 f m1 m2 = reshape (cols m1) (f (cdat m1) (cdat m2)) -- check sizes ------------------------------------------------------------------ @@ -333,3 +336,7 @@ diagRect s r c | r < c = trans $ diagRect s c r | r > c = joinVert [diag s , zeros (r-c,c)] where zeros (r,c) = reshape c $ constant (r*c) 0 + +takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] + +ident n = diag (constant n 1) -- cgit v1.2.3