diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-09-14 18:23:20 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-09-14 18:23:20 +0000 |
commit | d14515a4a50d5b5335f9c1525432b68ab67fa7c8 (patch) | |
tree | fb07b2e27b4b5cebc32a3c7ee064ef376344d7e7 /lib/Data/Packed/Matrix.hs | |
parent | 9e2f7fb0ca902665b430a96f77959522976a97f9 (diff) |
more refactoring
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 01e8133..fc08ce4 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs | |||
@@ -75,12 +75,12 @@ diagRect s r c | |||
75 | | r == c = diag s | 75 | | r == c = diag s |
76 | | r < c = trans $ diagRect s c r | 76 | | r < c = trans $ diagRect s c r |
77 | | r > c = joinVert [diag s , zeros (r-c,c)] | 77 | | r > c = joinVert [diag s , zeros (r-c,c)] |
78 | where zeros (r,c) = reshape c $ constant 0 (r*c) | 78 | where zeros (r,c) = reshape c $ constantD 0 (r*c) |
79 | 79 | ||
80 | takeDiag :: (Field t) => Matrix t -> Vector t | 80 | takeDiag :: (Field t) => Matrix t -> Vector t |
81 | takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] | 81 | takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] |
82 | 82 | ||
83 | ident :: (Num t, Field t) => Int -> Matrix t | 83 | ident :: Int -> Matrix Double |
84 | ident n = diag (constant 1 n) | 84 | ident n = diag (constant 1 n) |
85 | 85 | ||
86 | ------------------------------------------------------------ | 86 | ------------------------------------------------------------ |