Bug reported by Tracey Brendan. Thanks Tracey.
authorlangou <langou@users.noreply.github.com>
Thu, 10 Dec 2015 02:42:34 +0000 (02:42 +0000)
committerlangou <langou@users.noreply.github.com>
Thu, 10 Dec 2015 02:42:34 +0000 (02:42 +0000)
See: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4862

LAPACKE/src/lapacke_cunmlq_work.c
LAPACKE/src/lapacke_dormlq_work.c
LAPACKE/src/lapacke_sormlq_work.c
LAPACKE/src/lapacke_zunmlq_work.c

index b79a4f9..3e4226a 100644 (file)
@@ -74,8 +74,13 @@ lapack_int LAPACKE_cunmlq_work( int matrix_layout, char side, char trans,
             return (info < 0) ? (info - 1) : info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (lapack_complex_float*)
-            LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,m) );
+        if( LAPACKE_lsame( side, 'l' ) ) {
+            a_t = (lapack_complex_float*)
+                LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,m) );
+        } else {
+            a_t = (lapack_complex_float*)
+                LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
+        }
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
index 8f3d32c..f46c6d3 100644 (file)
@@ -72,7 +72,11 @@ lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans,
             return (info < 0) ? (info - 1) : info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,m) );
+        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) );
+        }
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
index a277436..b02a2d1 100644 (file)
@@ -72,7 +72,11 @@ lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans,
             return (info < 0) ? (info - 1) : info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,m) );
+        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) );
+        }
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
index 08d86ce..d75224b 100644 (file)
@@ -74,8 +74,13 @@ lapack_int LAPACKE_zunmlq_work( int matrix_layout, char side, char trans,
             return (info < 0) ? (info - 1) : info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (lapack_complex_double*)
-            LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,m) );
+        if( LAPACKE_lsame( side, 'l' ) ) {
+            a_t = (lapack_complex_double*)
+                LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,m) );
+        } else {
+            a_t = (lapack_complex_double*)
+                LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
+        }
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;