Skip to content

Commit a5c35bb

Browse files
committed
fixed bug
1 parent eadeb91 commit a5c35bb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ list(PREPEND CMAKE_MODULE_PATH
6262
"${CMAKE_CURRENT_LIST_DIR}/cmake/third_party"
6363
)
6464

65-
65+
include(sanitizers)
6666
if(NASOQ_WITH_EIGEN)
6767
include(eigen)
6868
endif()

src/clapacke/clapacke_dsytrf.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ int LAPACKE_dsytrf(
4646
if('L' != uplo && 'U' != uplo) {
4747
return -2; // argument 2 has an illegal value
4848
}
49+
char uplo_s[2];
50+
uplo_s[0] = uplo;
51+
uplo_s[1] = '\0';
4952

5053
// helper function to transpose an array
5154
auto transpose_into = [](double* out_x_t, clapack_int ldx_t, const double* x, clapack_int ldx, clapack_int n, int matrix_layout, char uplo) {
@@ -75,7 +78,7 @@ int LAPACKE_dsytrf(
7578
clapack_int info = 0;
7679
clapack_int lwork = -1; // flag to query work size
7780
double work_d; // a length-1 array of working space, as far as `dsytrf_` is concerned
78-
dsytrf_(&uplo, &n, a, &lda, ipiv, &work_d, &lwork, &info);
81+
dsytrf_(uplo_s, &n, a, &lda, ipiv, &work_d, &lwork, &info);
7982
if(info < 0) {
8083
return info-1;
8184
} else {
@@ -97,7 +100,7 @@ int LAPACKE_dsytrf(
97100
// call CLAPACK function on the transposed array
98101
std::vector<double> a_t(lda_t * maximum<clapack_int>(1,n));
99102
transpose_into(a_t.data(), lda_t, a, lda, n, matrix_layout, uplo);
100-
dsytrf_(&uplo, &n, a_t.data(), &lda_t, ipiv, work.data(), &lwork, &info);
103+
dsytrf_(uplo_s, &n, a_t.data(), &lda_t, ipiv, work.data(), &lwork, &info);
101104
if(info < 0) return info-1;
102105
transpose_into(a, lda, a_t.data(), lda_t, n, LAPACK_COL_MAJOR, uplo);
103106
} else if(LAPACK_COL_MAJOR == matrix_layout) {
@@ -110,7 +113,7 @@ int LAPACKE_dsytrf(
110113
std::vector<double> work(lwork);
111114

112115
// call CLAPACK function
113-
dsytrf_(&uplo, &n, a, &lda, ipiv, work.data(), &lwork, &info);
116+
dsytrf_(uplo_s, &n, a, &lda, ipiv, work.data(), &lwork, &info);
114117
if(info < 0) return info-1;
115118
} else {
116119
return -1; // argument 1 has an illegal value

0 commit comments

Comments
 (0)