summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-02 18:59:50 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-02 18:59:50 +0000
commit42bec1ac9911131b552f66779203eb599a86563d (patch)
treec4aefaedb21730644fcd4d2f85d830fe4d4daf07 /lib/Numeric/GSL/Matrix.hs
parentd925bada507562250a75587c409bdb35bbbc6ed8 (diff)
lapack real and complex unpacked QR
Diffstat (limited to 'lib/Numeric/GSL/Matrix.hs')
-rw-r--r--lib/Numeric/GSL/Matrix.hs26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/Numeric/GSL/Matrix.hs b/lib/Numeric/GSL/Matrix.hs
index eb1931a..5a5c19e 100644
--- a/lib/Numeric/GSL/Matrix.hs
+++ b/lib/Numeric/GSL/Matrix.hs
@@ -16,7 +16,7 @@
16module Numeric.GSL.Matrix( 16module Numeric.GSL.Matrix(
17 eigSg, eigHg, 17 eigSg, eigHg,
18 svdg, 18 svdg,
19 qr, 19 qr, qrPacked, unpackQR,
20 cholR, -- cholC, 20 cholR, -- cholC,
21 luSolveR, luSolveC, 21 luSolveR, luSolveC,
22 luR, luC 22 luR, luC
@@ -149,6 +149,30 @@ qr x = unsafePerformIO $ do
149 c = cols x 149 c = cols x
150foreign import ccall "gsl-aux.h QR" c_qr :: TMMM 150foreign import ccall "gsl-aux.h QR" c_qr :: TMMM
151 151
152qrPacked :: Matrix Double -> (Matrix Double, Vector Double)
153qrPacked x = unsafePerformIO $ do
154 qr <- createMatrix RowMajor r c
155 tau <- createVector (min r c)
156 c_qrPacked // mat cdat x // mat dat qr // vec tau // check "qrUnpacked" [cdat x]
157 return (qr,tau)
158 where r = rows x
159 c = cols x
160foreign import ccall "gsl-aux.h QRpacked" c_qrPacked :: TMMV
161
162unpackQR :: (Matrix Double, Vector Double) -> (Matrix Double, Matrix Double)
163unpackQR (qr,tau) = unsafePerformIO $ do
164 q <- createMatrix RowMajor r r
165 rot <- createMatrix RowMajor r c
166 c_qrUnpack // mat cdat qr // vec tau // mat dat q // mat dat rot // check "qrUnpack" [cdat qr,tau]
167 return (q,rot)
168 where r = rows qr
169 c = cols qr
170foreign import ccall "gsl-aux.h QRunpack" c_qrUnpack :: TMVMM
171
172
173type TMMV = Int -> Int -> PD -> TMV
174type TMVMM = Int -> Int -> PD -> Int -> PD -> TMM
175
152{- | Cholesky decomposition of a symmetric positive definite real matrix using /gsl_linalg_cholesky_decomp/. 176{- | Cholesky decomposition of a symmetric positive definite real matrix using /gsl_linalg_cholesky_decomp/.
153 177
154@\> chol $ (2><2) [1,2, 178@\> chol $ (2><2) [1,2,