summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-09 15:45:06 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-09 15:45:06 +0000
commit631a32fbdc0d61f647d3217da86bcb1d552e5e5a (patch)
tree2b81e4e6b9d7ae646787bc3ff8684b2d759b24c5 /lib/Data/Packed/Matrix.hs
parent34380f2b5d7b048a4d68197f16a8db0e53742030 (diff)
simplified (but wrong)
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r--lib/Data/Packed/Matrix.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index 2e8cb3d..45aaaba 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -77,7 +77,7 @@ diagRect s r c
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 $ constant 0 (r*c)
79 79
80takeDiag :: (Storable t) => Matrix t -> Vector t 80takeDiag :: (Field t) => Matrix t -> Vector t
81takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]] 81takeDiag m = fromList [cdat m `at` (k*cols m+k) | k <- [0 .. min (rows m) (cols m) -1]]
82 82
83ident :: (Num t, Field t) => Int -> Matrix t 83ident :: (Num t, Field t) => Int -> Matrix t
@@ -119,7 +119,7 @@ dropColumns n mat = subMatrix (0,n) (rows mat, cols mat - n) mat
119@\> flatten ('ident' 3) 119@\> flatten ('ident' 3)
1209 # [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]@ 1209 # [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]@
121-} 121-}
122flatten :: Matrix t -> Vector t 122flatten :: Field t => Matrix t -> Vector t
123flatten = cdat 123flatten = cdat
124 124
125-- | Creates a 'Matrix' from a list of lists (considered as rows). 125-- | Creates a 'Matrix' from a list of lists (considered as rows).