The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

Dorml2 size check still wrong for RowMajor

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

Dorml2 size check still wrong for RowMajor

Postby btracey » Wed Dec 09, 2015 1:17 am

In the new update, the size of a is still wrong in Dorml2. Starting at line 74 of lapacke_dormlq_work.c the code needs to be as listed below. The size of a is dependent on the value of side.

Code: Select all
  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;
        }
        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( side, 'l' )){
            LAPACKE_dge_trans( matrix_layout, k, m, a, lda, a_t, lda_t );
        }else{
            LAPACKE_dge_trans( matrix_layout, k, n, a, lda, a_t, lda_t );
        }
btracey
 
Posts: 11
Joined: Mon Aug 10, 2015 6:40 pm

Re: Dorml2 size check still wrong for RowMajor

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

Hi Tracey,

Thanks for the bug report. See commit 1667.

Here is the diff for reference.
Code: Select all
-        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) );
+        }


Note, we could also have written:
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,r) );
Where "r" is already initialized to be "m" or "n" depending on whether "side" is "L" or "R".
But I think your fix was clearer so I went with your fix on purpose.

Julien.
Julien Langou
 
Posts: 835
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 1 guest