From 92b1ed5e7fcbebbfbcde34206c040a8472d847d9 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 7 Jun 2007 11:13:32 +0000 Subject: adapting lapack wrappers --- lib/Data/Packed/Internal/Matrix.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Data/Packed/Internal/Matrix.hs') 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 toRows' k | k == r*c = [] | otherwise = subVector k c v : toRows' (k+c) +----------------------------------------------------------------- + +liftMatrix f m = m { dat = f dat, tdat = f tdat } -- check sizes + ------------------------------------------------------------------ dotL a b = sum (zipWith (*) a b) @@ -208,6 +212,16 @@ multiplyD order a b ---------------------------------------------------------------------- +outer u v = dat (multiply RowMajor r c) + where r = matrixFromVector RowMajor 1 u + c = matrixFromVector RowMajor (dim v) v + +dot u v = dat (multiply RowMajor r c) `at` 0 + where r = matrixFromVector RowMajor (dim u) u + c = matrixFromVector RowMajor 1 v + +---------------------------------------------------------------------- + -- | extraction of a submatrix of a real matrix subMatrixR :: (Int,Int) -- ^ (r0,c0) starting position -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix -- cgit v1.2.3