diff options
author | Vladimir Chalupecky <vladimir.chalupecky@gmail.com> | 2017-02-19 01:10:31 +0100 |
---|---|---|
committer | Vladimir Chalupecky <vladimir.chalupecky@gmail.com> | 2017-02-19 01:10:31 +0100 |
commit | d2e8152437f40e7ad2a92717c84efbc810e8f000 (patch) | |
tree | 9ad26ebb0393fa0ae18e167bde2f4e7243b8a95d /LAPACKE/src | |
parent | 4c48941747aba6d9a87e1664c115ba391b8dfcc5 (diff) | |
download | lapack-d2e8152437f40e7ad2a92717c84efbc810e8f000.tar.gz lapack-d2e8152437f40e7ad2a92717c84efbc810e8f000.tar.bz2 lapack-d2e8152437f40e7ad2a92717c84efbc810e8f000.zip |
LAPACKE: fix wrong number of columns in ?ormlq
Diffstat (limited to 'LAPACKE/src')
-rw-r--r-- | LAPACKE/src/lapacke_dormlq.c | 3 | ||||
-rw-r--r-- | LAPACKE/src/lapacke_dormlq_work.c | 11 | ||||
-rw-r--r-- | LAPACKE/src/lapacke_sormlq.c | 3 | ||||
-rw-r--r-- | LAPACKE/src/lapacke_sormlq_work.c | 11 |
4 files changed, 10 insertions, 18 deletions
diff --git a/LAPACKE/src/lapacke_dormlq.c b/LAPACKE/src/lapacke_dormlq.c index 77f0b85b..e4bf0c14 100644 --- a/LAPACKE/src/lapacke_dormlq.c +++ b/LAPACKE/src/lapacke_dormlq.c @@ -48,7 +48,8 @@ lapack_int LAPACKE_dormlq( int matrix_layout, char side, char trans, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ - if( LAPACKE_dge_nancheck( matrix_layout, k, m, a, lda ) ) { + lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n; + if( LAPACKE_dge_nancheck( matrix_layout, k, r, a, lda ) ) { return -7; } if( LAPACKE_dge_nancheck( matrix_layout, m, n, c, ldc ) ) { diff --git a/LAPACKE/src/lapacke_dormlq_work.c b/LAPACKE/src/lapacke_dormlq_work.c index 7f11cabe..a326feff 100644 --- a/LAPACKE/src/lapacke_dormlq_work.c +++ b/LAPACKE/src/lapacke_dormlq_work.c @@ -40,7 +40,6 @@ lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans, double* work, lapack_int lwork ) { lapack_int info = 0; - lapack_int r; if( matrix_layout == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_dormlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, @@ -49,7 +48,7 @@ lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans, info = info - 1; } } else if( matrix_layout == LAPACK_ROW_MAJOR ) { - r = LAPACKE_lsame( side, 'l' ) ? m : n; + lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n; lapack_int lda_t = MAX(1,k); lapack_int ldc_t = MAX(1,m); double *a_t = NULL; @@ -72,11 +71,7 @@ lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans, return (info < 0) ? (info - 1) : info; } /* Allocate memory for temporary array(s) */ - if( LAPACKE_lsame( side, 'l' ) ) { - a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,m) ); - } else { - a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) ); - } + a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,r) ); if( a_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; @@ -87,7 +82,7 @@ lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans, goto exit_level_1; } /* Transpose input matrices */ - LAPACKE_dge_trans( matrix_layout, k, m, a, lda, a_t, lda_t ); + LAPACKE_dge_trans( matrix_layout, k, r, a, lda, a_t, lda_t ); LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t ); /* Call LAPACK function and adjust info */ LAPACK_dormlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t, diff --git a/LAPACKE/src/lapacke_sormlq.c b/LAPACKE/src/lapacke_sormlq.c index 25b522b6..c05fdb1e 100644 --- a/LAPACKE/src/lapacke_sormlq.c +++ b/LAPACKE/src/lapacke_sormlq.c @@ -48,7 +48,8 @@ lapack_int LAPACKE_sormlq( int matrix_layout, char side, char trans, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ - if( LAPACKE_sge_nancheck( matrix_layout, k, m, a, lda ) ) { + lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n; + if( LAPACKE_sge_nancheck( matrix_layout, k, r, a, lda ) ) { return -7; } if( LAPACKE_sge_nancheck( matrix_layout, m, n, c, ldc ) ) { diff --git a/LAPACKE/src/lapacke_sormlq_work.c b/LAPACKE/src/lapacke_sormlq_work.c index 4e488e2a..08973329 100644 --- a/LAPACKE/src/lapacke_sormlq_work.c +++ b/LAPACKE/src/lapacke_sormlq_work.c @@ -40,7 +40,6 @@ lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans, float* work, lapack_int lwork ) { lapack_int info = 0; - lapack_int r; if( matrix_layout == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_sormlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, @@ -49,7 +48,7 @@ lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans, info = info - 1; } } else if( matrix_layout == LAPACK_ROW_MAJOR ) { - r = LAPACKE_lsame( side, 'l' ) ? m : n; + lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n; lapack_int lda_t = MAX(1,k); lapack_int ldc_t = MAX(1,m); float *a_t = NULL; @@ -72,11 +71,7 @@ lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans, return (info < 0) ? (info - 1) : info; } /* Allocate memory for temporary array(s) */ - if( LAPACKE_lsame( side, 'l' ) ) { - a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,m) ); - } else { - a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) ); - } + a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,r) ); if( a_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; @@ -87,7 +82,7 @@ lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans, goto exit_level_1; } /* Transpose input matrices */ - LAPACKE_sge_trans( matrix_layout, k, m, a, lda, a_t, lda_t ); + LAPACKE_sge_trans( matrix_layout, k, r, a, lda, a_t, lda_t ); LAPACKE_sge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t ); /* Call LAPACK function and adjust info */ LAPACK_sormlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t, |