Fix lantr preparation for row major matrices
authorkortschak <dan.kortschak@adelaide.edu.au>
Tue, 8 Sep 2015 23:55:48 +0000 (09:25 +0930)
committerkortschak <dan.kortschak@adelaide.edu.au>
Tue, 8 Sep 2015 23:55:48 +0000 (09:25 +0930)
lapack-netlib/lapacke/src/lapacke_clantr.c
lapack-netlib/lapacke/src/lapacke_clantr_work.c
lapack-netlib/lapacke/src/lapacke_dlantr.c
lapack-netlib/lapacke/src/lapacke_dlantr_work.c
lapack-netlib/lapacke/src/lapacke_slantr.c
lapack-netlib/lapacke/src/lapacke_slantr_work.c
lapack-netlib/lapacke/src/lapacke_zlantr.c
lapack-netlib/lapacke/src/lapacke_zlantr_work.c

index 77743f2..00ba342 100644 (file)
@@ -53,7 +53,7 @@ float LAPACKE_clantr( int matrix_order, char norm, char uplo, char diag,
     /* Allocate memory for working array(s) */
     if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
         LAPACKE_lsame( norm, '0' ) ) {
-        work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
+        work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
         if( work == NULL ) {
             info = LAPACK_WORK_MEMORY_ERROR;
             goto exit_level_0;
index cb253a1..1fa8cd9 100644 (file)
@@ -47,7 +47,7 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo,
             info = info - 1;
         }
     } else if( matrix_order == LAPACK_ROW_MAJOR ) {
-        lapack_int lda_t = MAX(1,n);
+        lapack_int lda_t = MAX(1,m);
         lapack_complex_float* a_t = NULL;
         /* Check leading dimension(s) */
         if( lda < n ) {
@@ -57,13 +57,13 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo,
         }
         /* Allocate memory for temporary array(s) */
         a_t = (lapack_complex_float*)
-            LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
+            LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,MAX(m,n)) );
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
         }
         /* Transpose input matrices */
-        LAPACKE_ctr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
+        LAPACKE_ctr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
         /* Call LAPACK function and adjust info */
         res = LAPACK_clantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
         info = 0;  /* LAPACK call is ok! */
index 522122c..2cde1eb 100644 (file)
@@ -53,7 +53,7 @@ double LAPACKE_dlantr( int matrix_order, char norm, char uplo, char diag,
     /* Allocate memory for working array(s) */
     if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
         LAPACKE_lsame( norm, '0' ) ) {
-        work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
+        work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
         if( work == NULL ) {
             info = LAPACK_WORK_MEMORY_ERROR;
             goto exit_level_0;
index 0a937bd..44d638f 100644 (file)
@@ -46,7 +46,7 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo,
             info = info - 1;
         }
     } else if( matrix_order == LAPACK_ROW_MAJOR ) {
-        lapack_int lda_t = MAX(1,n);
+        lapack_int lda_t = MAX(1,m);
         double* a_t = NULL;
         /* Check leading dimension(s) */
         if( lda < n ) {
@@ -55,13 +55,13 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo,
             return info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
+        a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,MAX(m,n)) );
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
         }
         /* Transpose input matrices */
-        LAPACKE_dtr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
+        LAPACKE_dtr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
         /* Call LAPACK function and adjust info */
         res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
         info = 0;  /* LAPACK call is ok! */
index d6a5120..80313d1 100644 (file)
@@ -53,7 +53,7 @@ float LAPACKE_slantr( int matrix_order, char norm, char uplo, char diag,
     /* Allocate memory for working array(s) */
     if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
         LAPACKE_lsame( norm, '0' ) ) {
-        work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
+        work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
         if( work == NULL ) {
             info = LAPACK_WORK_MEMORY_ERROR;
             goto exit_level_0;
index 2389468..9032f70 100644 (file)
@@ -46,7 +46,7 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo,
             info = info - 1;
         }
     } else if( matrix_order == LAPACK_ROW_MAJOR ) {
-        lapack_int lda_t = MAX(1,n);
+        lapack_int lda_t = MAX(1,m);
         float* a_t = NULL;
         /* Check leading dimension(s) */
         if( lda < n ) {
@@ -55,13 +55,13 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo,
             return info;
         }
         /* Allocate memory for temporary array(s) */
-        a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
+        a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,MAX(m,n)) );
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
         }
         /* Transpose input matrices */
-        LAPACKE_str_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
+        LAPACKE_str_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
         /* Call LAPACK function and adjust info */
         res = LAPACK_slantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
         info = 0;  /* LAPACK call is ok! */
index 887bc2e..001ce68 100644 (file)
@@ -53,7 +53,7 @@ double LAPACKE_zlantr( int matrix_order, char norm, char uplo, char diag,
     /* Allocate memory for working array(s) */
     if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
         LAPACKE_lsame( norm, '0' ) ) {
-        work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
+        work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
         if( work == NULL ) {
             info = LAPACK_WORK_MEMORY_ERROR;
             goto exit_level_0;
index 65e7414..8700a6e 100644 (file)
@@ -47,7 +47,7 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo,
             info = info - 1;
         }
     } else if( matrix_order == LAPACK_ROW_MAJOR ) {
-        lapack_int lda_t = MAX(1,n);
+        lapack_int lda_t = MAX(1,m);
         lapack_complex_double* a_t = NULL;
         /* Check leading dimension(s) */
         if( lda < n ) {
@@ -57,13 +57,13 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo,
         }
         /* Allocate memory for temporary array(s) */
         a_t = (lapack_complex_double*)
-            LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
+            LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,MAX(m,n)) );
         if( a_t == NULL ) {
             info = LAPACK_TRANSPOSE_MEMORY_ERROR;
             goto exit_level_0;
         }
         /* Transpose input matrices */
-        LAPACKE_ztr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
+        LAPACKE_ztr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
         /* Call LAPACK function and adjust info */
         res = LAPACK_zlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
         info = 0;  /* LAPACK call is ok! */