diff --git a/la/matrix_ops.v b/la/matrix_ops.v index 36741541c..9e8cfa1f8 100644 --- a/la/matrix_ops.v +++ b/la/matrix_ops.v @@ -90,8 +90,8 @@ pub fn matrix_svd(mut s []f64, mut u Matrix[f64], mut vt Matrix[f64], mut a Matr if copy_a { acpy = a.clone() } - vlas.dgesvd(byte(`A`), byte(`A`), a.m, a.n, acpy.data, 1, s, u.data, a.m, vt.data, - a.n, superb) + vlas.dgesvd(&char('A'.str), &char('A'.str), a.m, a.n, acpy.data, 1, s, u.data, a.m, + vt.data, a.n, superb) } // matrix_inv computes the inverse of a general matrix (square or not). It also computes the diff --git a/vlas/conversions.v b/vlas/conversions.v index 0d88b4367..ba8416806 100644 --- a/vlas/conversions.v +++ b/vlas/conversions.v @@ -20,18 +20,16 @@ pub fn c_uplo(up bool) vblas.Uplo { return .lower } -pub fn l_uplo(up bool) u8 { - if up { - return `U` - } - return `L` +fn l_uplo(up bool) u8 { + return if up { `U` } else { `L` } } -pub fn job_vlr(do_calc bool) u8 { - if do_calc { - return `V` - } - return `N` +fn job_vlr(do_calc bool) &char { + return &char(if do_calc { + 'V' + } else { + 'N' + }.str) } // slice_to_col_major converts nested slice into an array representing a col-major matrix diff --git a/vlas/lapack.v b/vlas/lapack.v index c9943fbbe..e9c306366 100644 --- a/vlas/lapack.v +++ b/vlas/lapack.v @@ -5,7 +5,7 @@ import vsl.vlas.internal.vblas fn C.LAPACKE_dgesv(matrix_layout vblas.MemoryLayout, n int, nrhs int, a &f64, lda int, ipiv &int, b &f64, ldb int) int -fn C.LAPACKE_dgesvd(matrix_layout vblas.MemoryLayout, jobu byte, jobvt byte, m int, n int, a &f64, lda int, s &f64, u &f64, ldu int, vt &f64, ldvt int, superb &f64) int +fn C.LAPACKE_dgesvd(matrix_layout vblas.MemoryLayout, jobu &char, jobvt &char, m int, n int, a &f64, lda int, s &f64, u &f64, ldu int, vt &f64, ldvt int, superb &f64) int fn C.LAPACKE_dgetrf(matrix_layout vblas.MemoryLayout, m int, n int, a &f64, lda int, ipiv &int) int @@ -13,13 +13,13 @@ fn C.LAPACKE_dgetri(matrix_layout vblas.MemoryLayout, n int, a &f64, lda int, ip fn C.LAPACKE_dpotrf(matrix_layout vblas.MemoryLayout, up u32, n int, a &f64, lda int) int -fn C.LAPACKE_dgeev(matrix_layout vblas.MemoryLayout, calc_vl byte, calc_vr byte, n int, a &f64, lda int, wr &f64, wi &f64, vl &f64, ldvl_ int, vr &f64, ldvr_ int) int +fn C.LAPACKE_dgeev(matrix_layout vblas.MemoryLayout, calc_vl &char, calc_vr &char, n int, a &f64, lda int, wr &f64, wi &f64, vl &f64, ldvl_ int, vr &f64, ldvr_ int) int -fn C.LAPACKE_dlange(matrix_layout vblas.MemoryLayout, norm byte, m int, n int, a &f64, lda int, work &f64) f64 +fn C.LAPACKE_dlange(matrix_layout vblas.MemoryLayout, norm &char, m int, n int, a &f64, lda int, work &f64) f64 -fn C.LAPACKE_dsyev(matrix_layout vblas.MemoryLayout, jobz byte, uplo byte, n int, a &f64, lda int, w &f64, work &f64, lwork int) int +fn C.LAPACKE_dsyev(matrix_layout vblas.MemoryLayout, jobz &char, uplo &char, n int, a &f64, lda int, w &f64, work &f64, lwork int) int -fn C.LAPACKE_dgebal(matrix_layout vblas.MemoryLayout, job byte, n int, a &f64, lda int, ilo int, ihi int, scale &f64) int +fn C.LAPACKE_dgebal(matrix_layout vblas.MemoryLayout, job &char, n int, a &f64, lda int, ilo int, ihi int, scale &f64) int fn C.LAPACKE_dgehrd(matrix_layout vblas.MemoryLayout, n int, ilo int, ihi int, a &f64, lda int, tau &f64, work &f64, lwork int) int @@ -76,7 +76,7 @@ pub fn dgesv(n int, nrhs int, mut a []f64, lda int, ipiv []int, mut b []f64, ldb // Note that the routine returns V**T, not V. // // NOTE: matrix 'a' will be modified -pub fn dgesvd(jobu byte, jobvt byte, m int, n int, a []f64, lda int, s []f64, u []f64, ldu int, vt []f64, ldvt int, superb []f64) { +pub fn dgesvd(jobu &char, jobvt &char, m int, n int, a []f64, lda int, s []f64, u []f64, ldu int, vt []f64, ldvt int, superb []f64) { info := C.LAPACKE_dgesvd(.row_major, jobu, jobvt, m, n, &a[0], lda, &s[0], &u[0], ldu, &vt[0], ldvt, &superb[0]) if info != 0 { @@ -199,6 +199,6 @@ pub fn dgeev(calc_vl bool, calc_vr bool, n int, mut a []f64, lda int, wr []f64, } } -pub fn dlange(norm byte, m int, n int, a []f64, lda int, work []f64) f64 { +pub fn dlange(norm &char, m int, n int, a []f64, lda int, work []f64) f64 { return unsafe { C.LAPACKE_dlange(.row_major, norm, m, n, &a[0], lda, &work[0]) } }