From e8ee2d10ecde8aaef64f7319fbc4a0f9589dddac Mon Sep 17 00:00:00 2001 From: Chris Vales Date: Fri, 2 Feb 2024 17:13:12 -0500 Subject: [PATCH] add lapack info checks (#265) --- lib/linalg/Matrix.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/linalg/Matrix.cpp b/lib/linalg/Matrix.cpp index 240d207e3..2313ae515 100644 --- a/lib/linalg/Matrix.cpp +++ b/lib/linalg/Matrix.cpp @@ -755,7 +755,11 @@ Matrix::inverse( } // Now call lapack to do the inversion. dgetrf(&mtx_size, &mtx_size, result->d_mat, &mtx_size, ipiv, &info); + CAROM_VERIFY(info == 0); + dgetri(&mtx_size, result->d_mat, &mtx_size, ipiv, work, &lwork, &info); + CAROM_VERIFY(info == 0); + // Result now has the inverse in a column major representation. Put it // into row major order. for (int row = 0; row < mtx_size; ++row) { @@ -798,7 +802,11 @@ Matrix::inverse( } // Now call lapack to do the inversion. dgetrf(&mtx_size, &mtx_size, result.d_mat, &mtx_size, ipiv, &info); + CAROM_VERIFY(info == 0); + dgetri(&mtx_size, result.d_mat, &mtx_size, ipiv, work, &lwork, &info); + CAROM_VERIFY(info == 0); + // Result now has the inverse in a column major representation. Put it // into row major order. for (int row = 0; row < mtx_size; ++row) { @@ -852,7 +860,11 @@ Matrix::inverse() } // Now call lapack to do the inversion. dgetrf(&mtx_size, &mtx_size, d_mat, &mtx_size, ipiv, &info); + CAROM_VERIFY(info == 0); + dgetri(&mtx_size, d_mat, &mtx_size, ipiv, work, &lwork, &info); + CAROM_VERIFY(info == 0); + // This now has its inverse in a column major representation. Put it into // row major representation. for (int row = 0; row < mtx_size; ++row) {