### lapacke_?laset has limitations

Posted:

**Thu Jul 09, 2015 12:09 am**The code of lapacke_dlaset.c assumed NaN checking as follows

...

#ifndef LAPACK_DISABLE_NAN_CHECK

/* Optionally check input matrices for NaNs */

if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {

return -7;

}

if( LAPACKE_d_nancheck( 1, &alpha, 1 ) ) {

return -5;

}

if( LAPACKE_d_nancheck( 1, &beta, 1 ) ) {

return -6;

}

#endif

...

Matrix pointed by a is assumed to be initialized by this functions and should not be checked for NaNs. The array may contain NaNs and in such a case the function will return -7 without initialization.

I even doubt that parameters alpha and beta should be checked for NaN. From one point of view, it is OK if the matrix is assumed to be processed by some LAPACK function but from other point of view it is restriction of functionality. A user may want to initialize the matrix with NaNs - why would not we allow to do so?

...

#ifndef LAPACK_DISABLE_NAN_CHECK

/* Optionally check input matrices for NaNs */

if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {

return -7;

}

if( LAPACKE_d_nancheck( 1, &alpha, 1 ) ) {

return -5;

}

if( LAPACKE_d_nancheck( 1, &beta, 1 ) ) {

return -6;

}

#endif

...

Matrix pointed by a is assumed to be initialized by this functions and should not be checked for NaNs. The array may contain NaNs and in such a case the function will return -7 without initialization.

I even doubt that parameters alpha and beta should be checked for NaN. From one point of view, it is OK if the matrix is assumed to be processed by some LAPACK function but from other point of view it is restriction of functionality. A user may want to initialize the matrix with NaNs - why would not we allow to do so?