diff options
author | Maxim Koltsov <kolmax94@gmail.com> | 2018-11-19 20:43:22 +0300 |
---|---|---|
committer | Maxim Koltsov <kolmax94@gmail.com> | 2018-11-19 20:44:37 +0300 |
commit | f4124fa6209cbf8290fed2be51cec8464bf7f1b9 (patch) | |
tree | 7e1cf379a31fe3f83ae1ce5a3b1feaaad11223fa /packages/base/src | |
parent | 480c4db1585ed122dfc491bb15421565966dad66 (diff) |
Fix #282
LAPACK routine dgttrf mutates its inputs per documentation. To prevent
user-visible breakage input vectors must be copied before sending them
to LAPACK.
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Internal/LAPACK.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/base/src/Internal/LAPACK.hs b/packages/base/src/Internal/LAPACK.hs index ff55688..27d1f95 100644 --- a/packages/base/src/Internal/LAPACK.hs +++ b/packages/base/src/Internal/LAPACK.hs | |||
@@ -506,8 +506,10 @@ linearSolveGTAux2 g f st dl d du b | |||
506 | | ndl == nd - 1 && | 506 | | ndl == nd - 1 && |
507 | ndu == nd - 1 && | 507 | ndu == nd - 1 && |
508 | nd == r = unsafePerformIO . g $ do | 508 | nd == r = unsafePerformIO . g $ do |
509 | dl' <- head . toRows <$> copy ColumnMajor (fromRows [dl]) | ||
510 | du' <- head . toRows <$> copy ColumnMajor (fromRows [du]) | ||
509 | s <- copy ColumnMajor b | 511 | s <- copy ColumnMajor b |
510 | (dl # d # du #! s) f #| st | 512 | (dl' # d # du' #! s) f #| st |
511 | return s | 513 | return s |
512 | | otherwise = error $ st ++ " of nonsquare matrix" | 514 | | otherwise = error $ st ++ " of nonsquare matrix" |
513 | where | 515 | where |