From e83de293d661b7036e276105c5cc2ac10a900964 Mon Sep 17 00:00:00 2001 From: ulises-jeremias Date: Sun, 23 Jun 2024 04:06:14 -0300 Subject: [PATCH] refactor: Update LAPACK functions in lapack_notd_vsl_lapack_lapacke.v to handle errors and use named constants --- lapack/cflags_notd_vsl_lapack_lapacke.v | 14 -------------- lapack/lapack_notd_vsl_lapack_lapacke.v | 8 ++++---- 2 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 lapack/cflags_notd_vsl_lapack_lapacke.v diff --git a/lapack/cflags_notd_vsl_lapack_lapacke.v b/lapack/cflags_notd_vsl_lapack_lapacke.v deleted file mode 100644 index 081f788db..000000000 --- a/lapack/cflags_notd_vsl_lapack_lapacke.v +++ /dev/null @@ -1,14 +0,0 @@ -module lapack - -#flag linux -O2 -I/usr/local/include -I/usr/lib -#flag linux -L/usr/local/lib -L/usr/lib -#flag windows -O2 -#flag windows -lgfortran -// Intel, M1 brew, and MacPorts -#flag darwin -L/usr/local/opt/lapack/lib -L/opt/homebrew/opt/lapack/lib -L/opt/local/opt/lapack/lib -#flag -I@VMODROOT -#flag -llapacke - -$if macos { - #include -} diff --git a/lapack/lapack_notd_vsl_lapack_lapacke.v b/lapack/lapack_notd_vsl_lapack_lapacke.v index e16020046..e46de9120 100644 --- a/lapack/lapack_notd_vsl_lapack_lapacke.v +++ b/lapack/lapack_notd_vsl_lapack_lapacke.v @@ -55,7 +55,7 @@ pub fn dgesvd(jobu SVDJob, jobvt SVDJob, m int, n int, mut a []f64, lda int, s [ info := lapack64.dgesvd(jobu, jobvt, m, n, mut a, lda, s, mut u, ldu, mut vt, ldvt, superb) if info != 0 { - errors.vsl_panic('lapack failed', .efailed) + errors.vsl_panic('LAPACK dgesvd failed with error code: $info', .efailed) } } @@ -90,7 +90,7 @@ pub fn dgetrf(m int, n int, mut a []f64, lda int, mut ipiv []int) { pub fn dgetri(n int, mut a []f64, lda int, mut ipiv []int) { info := lapack64.dgetri(n, mut a, lda, mut ipiv) if info != 0 { - errors.vsl_panic('lapack failed', .efailed) + errors.vsl_panic('LAPACK dgesvd failed with error code: $info', .efailed) } } @@ -114,7 +114,7 @@ pub fn dgetri(n int, mut a []f64, lda int, mut ipiv []int) { pub fn dpotrf(uplo blas.Uplo, n int, mut a []f64, lda int) { info := lapack64.dpotrf(uplo, n, mut a, lda) if info != 0 { - errors.vsl_panic('lapack failed', .efailed) + errors.vsl_panic('LAPACK dgesvd failed with error code: $info', .efailed) } } @@ -163,6 +163,6 @@ pub fn dgeev(calc_vl LeftEVJob, calc_vr LeftEVJob, n int, mut a []f64, lda int, info := lapack64.dgeev(calc_vl, calc_vr, n, mut a, lda, wr, wi, mut vl, ldvl, mut vr, ldvr) if info != 0 { - errors.vsl_panic('lapack failed', .efailed) + errors.vsl_panic('LAPACK dgesvd failed with error code: $info', .efailed) } }