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.hs23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 5e6e649..8709a00 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -132,17 +132,22 @@ mat a f =
132 let m g = do 132 let m g = do
133 g (fi (rows a)) (fi (cols a)) p 133 g (fi (rows a)) (fi (cols a)) p
134 f m 134 f m
135-- | Creates a vector by concatenation of rows. If the matrix is ColumnMajor, this operation requires a transpose. 135
136-- 136{- | Creates a vector by concatenation of rows. If the matrix is ColumnMajor, this operation requires a transpose.
137-- @\> flatten ('ident' 3) 137
138-- 9 |> [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]@ 138>>> flatten (ident 3)
139fromList [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]
140
141-}
139flatten :: Element t => Matrix t -> Vector t 142flatten :: Element t => Matrix t -> Vector t
140flatten = xdat . cmat 143flatten = xdat . cmat
141 144
145{-
142type Mt t s = Int -> Int -> Ptr t -> s 146type Mt t s = Int -> Int -> Ptr t -> s
143-- not yet admitted by my haddock version 147
144-- infixr 6 ::> 148infixr 6 ::>
145-- type t ::> s = Mt t s 149type t ::> s = Mt t s
150-}
146 151
147-- | the inverse of 'Data.Packed.Matrix.fromLists' 152-- | the inverse of 'Data.Packed.Matrix.fromLists'
148toLists :: (Element t) => Matrix t -> [[t]] 153toLists :: (Element t) => Matrix t -> [[t]]
@@ -207,11 +212,11 @@ createMatrix ord r c = do
207{- | Creates a matrix from a vector by grouping the elements in rows with the desired number of columns. (GNU-Octave groups by columns. To do it you can define @reshapeF r = trans . reshape r@ 212{- | Creates a matrix from a vector by grouping the elements in rows with the desired number of columns. (GNU-Octave groups by columns. To do it you can define @reshapeF r = trans . reshape r@
208where r is the desired number of rows.) 213where r is the desired number of rows.)
209 214
210@\> reshape 4 ('fromList' [1..12]) 215>>> reshape 4 (fromList [1..12])
211(3><4) 216(3><4)
212 [ 1.0, 2.0, 3.0, 4.0 217 [ 1.0, 2.0, 3.0, 4.0
213 , 5.0, 6.0, 7.0, 8.0 218 , 5.0, 6.0, 7.0, 8.0
214 , 9.0, 10.0, 11.0, 12.0 ]@ 219 , 9.0, 10.0, 11.0, 12.0 ]
215 220
216-} 221-}
217reshape :: Storable t => Int -> Vector t -> Matrix t 222reshape :: Storable t => Int -> Vector t -> Matrix t