summaryrefslogtreecommitdiff
path: root/lib/LAPACK.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-06-23 20:21:03 +0000
committerAlberto Ruiz <aruiz@um.es>2007-06-23 20:21:03 +0000
commit3d5d6f06598aac00906c93ac5358e68697c47fc7 (patch)
tree77a76afcd561b8beee33c39b4eafe72b4fa10b86 /lib/LAPACK.hs
parent978e6d038239af50d70bae2c303f4e45b1879b7a (diff)
more refactoring
Diffstat (limited to 'lib/LAPACK.hs')
-rw-r--r--lib/LAPACK.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/LAPACK.hs b/lib/LAPACK.hs
index 602f5df..ff8889f 100644
--- a/lib/LAPACK.hs
+++ b/lib/LAPACK.hs
@@ -36,9 +36,10 @@ foreign import ccall "LAPACK/lapack-aux.h svd_l_R" dgesvd :: TMMVM
36-- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix. 36-- | Wrapper for LAPACK's /dgesvd/, which computes the full svd decomposition of a real matrix.
37-- 37--
38-- @(u,s,v)=svdR m@ so that @m=u \<\> s \<\> 'trans' v@. 38-- @(u,s,v)=svdR m@ so that @m=u \<\> s \<\> 'trans' v@.
39svdR :: Matrix Double -> (Matrix Double, Matrix Double , Matrix Double) 39svdR :: Matrix Double -> (Matrix Double, Matrix Double, Matrix Double)
40svdR x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdR' x 40svdR x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdR' x
41 41
42svdR' :: Matrix Double -> (Matrix Double, Vector Double, Matrix Double)
42svdR' x@M {rows = r, cols = c} = unsafePerformIO $ do 43svdR' x@M {rows = r, cols = c} = unsafePerformIO $ do
43 u <- createMatrix ColumnMajor r r 44 u <- createMatrix ColumnMajor r r
44 s <- createVector (min r c) 45 s <- createVector (min r c)
@@ -55,6 +56,7 @@ foreign import ccall "LAPACK/lapack-aux.h svd_l_Rdd" dgesdd :: TMMVM
55svdRdd :: Matrix Double -> (Matrix Double, Matrix Double , Matrix Double) 56svdRdd :: Matrix Double -> (Matrix Double, Matrix Double , Matrix Double)
56svdRdd x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdRdd' x 57svdRdd x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdRdd' x
57 58
59svdRdd' :: Matrix Double -> (Matrix Double, Vector Double, Matrix Double)
58svdRdd' x@M {rows = r, cols = c} = unsafePerformIO $ do 60svdRdd' x@M {rows = r, cols = c} = unsafePerformIO $ do
59 u <- createMatrix ColumnMajor r r 61 u <- createMatrix ColumnMajor r r
60 s <- createVector (min r c) 62 s <- createVector (min r c)
@@ -68,10 +70,10 @@ foreign import ccall "LAPACK/lapack-aux.h svd_l_C" zgesvd :: TCMCMVCM
68-- | Wrapper for LAPACK's /zgesvd/, which computes the full svd decomposition of a complex matrix. 70-- | Wrapper for LAPACK's /zgesvd/, which computes the full svd decomposition of a complex matrix.
69-- 71--
70-- @(u,s,v)=svdC m@ so that @m=u \<\> s \<\> 'trans' v@. 72-- @(u,s,v)=svdC m@ so that @m=u \<\> s \<\> 'trans' v@.
71svdC :: Matrix (Complex Double) 73svdC :: Matrix (Complex Double) -> (Matrix (Complex Double), Matrix Double, Matrix (Complex Double))
72 -> (Matrix (Complex Double), Matrix Double, Matrix (Complex Double))
73svdC x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdC' x 74svdC x@M {rows = r, cols = c} = (u, diagRect s r c, v) where (u,s,v) = svdC' x
74 75
76svdC' :: Matrix (Complex Double) -> (Matrix (Complex Double), Vector Double, Matrix (Complex Double))
75svdC' x@M {rows = r, cols = c} = unsafePerformIO $ do 77svdC' x@M {rows = r, cols = c} = unsafePerformIO $ do
76 u <- createMatrix ColumnMajor r r 78 u <- createMatrix ColumnMajor r r
77 s <- createVector (min r c) 79 s <- createVector (min r c)