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.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index ec6657a..db53cd1 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -160,6 +160,10 @@ toRows m = toRows' 0 where
160 toRows' k | k == r*c = [] 160 toRows' k | k == r*c = []
161 | otherwise = subVector k c v : toRows' (k+c) 161 | otherwise = subVector k c v : toRows' (k+c)
162 162
163-----------------------------------------------------------------
164
165liftMatrix f m = m { dat = f dat, tdat = f tdat } -- check sizes
166
163------------------------------------------------------------------ 167------------------------------------------------------------------
164 168
165dotL a b = sum (zipWith (*) a b) 169dotL a b = sum (zipWith (*) a b)
@@ -208,6 +212,16 @@ multiplyD order a b
208 212
209---------------------------------------------------------------------- 213----------------------------------------------------------------------
210 214
215outer u v = dat (multiply RowMajor r c)
216 where r = matrixFromVector RowMajor 1 u
217 c = matrixFromVector RowMajor (dim v) v
218
219dot u v = dat (multiply RowMajor r c) `at` 0
220 where r = matrixFromVector RowMajor (dim u) u
221 c = matrixFromVector RowMajor 1 v
222
223----------------------------------------------------------------------
224
211-- | extraction of a submatrix of a real matrix 225-- | extraction of a submatrix of a real matrix
212subMatrixR :: (Int,Int) -- ^ (r0,c0) starting position 226subMatrixR :: (Int,Int) -- ^ (r0,c0) starting position
213 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix 227 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix