diff options
Diffstat (limited to 'packages/base/src/Internal/LAPACK.hs')
-rw-r--r-- | packages/base/src/Internal/LAPACK.hs | 30 |
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 | |||
406 | cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | 406 | cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) |
407 | cholSolveC a b = linearSolveSQAux2 id zpotrs "cholSolveC" (fmat a) b | 407 | cholSolveC a b = linearSolveSQAux2 id zpotrs "cholSolveC" (fmat a) b |
408 | 408 | ||
409 | -------------------------------------------------------------------------------- | ||
410 | foreign import ccall unsafe "triSolveR_l_u" dtrtrs_u :: R ::> R ::> Ok | ||
411 | foreign import ccall unsafe "triSolveC_l_u" ztrtrs_u :: C ::> C ::> Ok | ||
412 | foreign import ccall unsafe "triSolveR_l_l" dtrtrs_l :: R ::> R ::> Ok | ||
413 | foreign import ccall unsafe "triSolveC_l_l" ztrtrs_l :: C ::> C ::> Ok | ||
414 | |||
415 | |||
416 | linearSolveTRAux2 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 | |||
427 | data UpLo = Lower | Upper | ||
428 | |||
429 | -- | Solves a triangular system of linear equations. | ||
430 | triSolveR :: UpLo -> Matrix Double -> Matrix Double -> Matrix Double | ||
431 | triSolveR Lower a b = linearSolveTRAux2 id dtrtrs_l "triSolveR" (fmat a) b | ||
432 | triSolveR Upper a b = linearSolveTRAux2 id dtrtrs_u "triSolveR" (fmat a) b | ||
433 | |||
434 | -- | Solves a triangular system of linear equations. | ||
435 | triSolveC :: UpLo -> Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | ||
436 | triSolveC Lower a b = linearSolveTRAux2 id ztrtrs_l "triSolveC" (fmat a) b | ||
437 | triSolveC Upper a b = linearSolveTRAux2 id ztrtrs_u "triSolveC" (fmat a) b | ||
438 | |||
409 | ----------------------------------------------------------------------------------- | 439 | ----------------------------------------------------------------------------------- |
410 | 440 | ||
411 | foreign import ccall unsafe "linearSolveLSR_l" dgels :: R ::> R ::> Ok | 441 | foreign import ccall unsafe "linearSolveLSR_l" dgels :: R ::> R ::> Ok |