From d168b4d2ae678904fb659b3caf27bce668f544e4 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 26 Apr 2020 00:57:37 +0200 Subject: [PATCH] Fix some minor inconsistencies in LAPACK(E)_[cz]gesvdq For LAPACKE_cgesvdq, align datatype of `rwork` with lapacke.h and callsite in LAPACKE_cgesvdq_work; both of the latter use `float* rwork`, so there's no need to calculate with doubles that only get downcast anyway. Similarly, make the signature of lapacke_zgesvdq_work consistent across lapack.h (modified here), the fortran side and lapacke_zgesvdq_work, see: https://github.com/Reference-LAPACK/lapack/blob/v3.9.0/LAPACKE/src/lapacke_zgesvdq_work.c#L42 https://github.com/Reference-LAPACK/lapack/blob/v3.9.0/SRC/zgesvdq.f#L422 --- LAPACKE/include/lapack.h | 2 +- LAPACKE/src/lapacke_cgesvdq.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LAPACKE/include/lapack.h b/LAPACKE/include/lapack.h index 4f48b7c87..c045892df 100644 --- a/LAPACKE/include/lapack.h +++ b/LAPACKE/include/lapack.h @@ -2513,7 +2513,7 @@ void LAPACK_zgesvdq( lapack_complex_double* U, lapack_int const* ldu, lapack_complex_double* V, lapack_int const* ldv, lapack_int* numrank, lapack_int* iwork, lapack_int const* liwork, - lapack_complex_float* cwork, lapack_int* lcwork, + lapack_complex_double* cwork, lapack_int* lcwork, double* rwork, lapack_int const* lrwork, lapack_int* info ); diff --git a/LAPACKE/src/lapacke_cgesvdq.c b/LAPACKE/src/lapacke_cgesvdq.c index 91458136c..c5eca535e 100644 --- a/LAPACKE/src/lapacke_cgesvdq.c +++ b/LAPACKE/src/lapacke_cgesvdq.c @@ -47,8 +47,8 @@ lapack_int LAPACKE_cgesvdq( int matrix_layout, char joba, char jobp, lapack_complex_float* cwork = NULL; lapack_complex_float cwork_query; lapack_int lrwork = -1; - double* rwork = NULL; - double rwork_query; + float* rwork = NULL; + float rwork_query; lapack_int i; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cgesvdq", -1 ); @@ -84,7 +84,7 @@ lapack_int LAPACKE_cgesvdq( int matrix_layout, char joba, char jobp, info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } - rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork ); + rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0;