summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/LAPACK.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/LAPACK.hs')
-rw-r--r--packages/base/src/Internal/LAPACK.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/base/src/Internal/LAPACK.hs b/packages/base/src/Internal/LAPACK.hs
index 231109a..b4dd5cf 100644
--- a/packages/base/src/Internal/LAPACK.hs
+++ b/packages/base/src/Internal/LAPACK.hs
@@ -406,6 +406,36 @@ cholSolveR a b = linearSolveSQAux2 id dpotrs "cholSolveR" (fmat a) b
406cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) 406cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
407cholSolveC a b = linearSolveSQAux2 id zpotrs "cholSolveC" (fmat a) b 407cholSolveC a b = linearSolveSQAux2 id zpotrs "cholSolveC" (fmat a) b
408 408
409--------------------------------------------------------------------------------
410foreign import ccall unsafe "triSolveR_l_u" dtrtrs_u :: R ::> R ::> Ok
411foreign import ccall unsafe "triSolveC_l_u" ztrtrs_u :: C ::> C ::> Ok
412foreign import ccall unsafe "triSolveR_l_l" dtrtrs_l :: R ::> R ::> Ok
413foreign import ccall unsafe "triSolveC_l_l" ztrtrs_l :: C ::> C ::> Ok
414
415
416linearSolveTRAux2 g f st a b
417 | n1==n2 && n1==r = unsafePerformIO . g $ do
418 s <- copy ColumnMajor b
419 (a #! s) f #| st
420 return s
421 | otherwise = error $ st ++ " of nonsquare matrix"
422 where
423 n1 = rows a
424 n2 = cols a
425 r = rows b
426
427data UpLo = Lower | Upper
428
429-- | Solves a triangular system of linear equations.
430triSolveR :: UpLo -> Matrix Double -> Matrix Double -> Matrix Double
431triSolveR Lower a b = linearSolveTRAux2 id dtrtrs_l "triSolveR" (fmat a) b
432triSolveR Upper a b = linearSolveTRAux2 id dtrtrs_u "triSolveR" (fmat a) b
433
434-- | Solves a triangular system of linear equations.
435triSolveC :: UpLo -> Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
436triSolveC Lower a b = linearSolveTRAux2 id ztrtrs_l "triSolveC" (fmat a) b
437triSolveC Upper a b = linearSolveTRAux2 id ztrtrs_u "triSolveC" (fmat a) b
438
409----------------------------------------------------------------------------------- 439-----------------------------------------------------------------------------------
410 440
411foreign import ccall unsafe "linearSolveLSR_l" dgels :: R ::> R ::> Ok 441foreign import ccall unsafe "linearSolveLSR_l" dgels :: R ::> R ::> Ok