Dormbr check wrong for RowMajor

Post here if you want to report a bug to the LAPACK team

Dormbr check wrong for RowMajor

Postby btracey » Wed Dec 09, 2015 3:49 am

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 );
btracey
 
Posts: 11
Joined: Mon Aug 10, 2015 6:40 pm

Re: Dormbr check wrong for RowMajor

Postby Julien Langou » Wed Dec 09, 2015 10:53 pm

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.
Julien Langou
 
Posts: 824
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to Bug report

Who is online

Users browsing this forum: No registered users and 2 guests