Page 1 of 1

Dormbr check wrong for RowMajor

PostPosted: Wed Dec 09, 2015 3:49 am
by btracey
The size of a depends on the values for q and l. The current size check is incorrect. The following code snippet fixes the issue. This is applied to lapacke_dormbr_work.c at line 76.

Code: Select all
        /* Allocate memory for temporary array(s) */
        if( LAPACKE_lsame( vect, 'q' ) ){
          a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * k );
        }else{
          a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * nq );
        }
     
        if( a_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_0;
        }
        c_t = (double*)LAPACKE_malloc( sizeof(double) * ldc_t * MAX(1,n) );
        if( c_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_1;
        }
        /* Transpose input matrices */
        if( LAPACKE_lsame( vect, 'q' ) ){
          LAPACKE_dge_trans( matrix_layout, nq, k, a, lda, a_t, lda_t );
        }else{
          LAPACKE_dge_trans( matrix_layout, k, nq, a, lda, a_t, lda_t );
        }
        LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );

Re: Dormbr check wrong for RowMajor

PostPosted: Wed Dec 09, 2015 10:53 pm
by Julien Langou
Hi Tracey,

Thanks for the bug report. See commit 1668.

Here is the diff for reference.

Code: Select all
-        a_t = (double*)
-            LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,MIN(nq,k)) );
+        if( LAPACKE_lsame( vect, 'q' ) ) {
+          a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,k) );
+        } else {
+          a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,nq) );
+        }


Julien.