correcting bug 128
authorlangou <langou@users.noreply.github.com>
Wed, 26 Aug 2015 04:42:47 +0000 (04:42 +0000)
committerlangou <langou@users.noreply.github.com>
Wed, 26 Aug 2015 04:42:47 +0000 (04:42 +0000)
See: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4746

When LAPACK_NAN_CHECK is enabled, in input of xLASET, we now allow if the matrix A contains NaN.

Since the goal of xLASET is to set values in A, we consider it OK if A contains NaN in input.

In other words, the rationale is that we do not consider A has an input/output. We consider A as an output only.

Note: We allow neither alpha nor beta to be a NaN.

(So we do check for NaN in alpha and in beta and return error if NaN.)

So this commit
(1) removes the NaN check on matrix A in LAPACKE wrappers: lapacke_?laset.c
(2) declares that A is OUTPUT in LAPACK subroutines: ?laset.f
(3) adds a thanks to Victor Kostin from Intel

LAPACKE/src/lapacke_claset.c
LAPACKE/src/lapacke_dlaset.c
LAPACKE/src/lapacke_slaset.c
LAPACKE/src/lapacke_zlaset.c
SRC/claset.f
SRC/dlaset.f
SRC/slaset.f
SRC/zlaset.f

index 2dfaf67..50a43fa 100644 (file)
@@ -38,15 +38,19 @@ lapack_int LAPACKE_claset( int matrix_layout, char uplo, lapack_int m,
                            lapack_complex_float beta, lapack_complex_float* a,
                            lapack_int lda )
 {
+
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_claset", -1 );
         return -1;
     }
+
+/*****************************************************************************
+*  Note: we do not check NaNs in A since the goal of this subroutine is to 
+*  initialized A. It is OK if A has NaNs in input. 
+*****************************************************************************/
+
 #ifndef LAPACK_DISABLE_NAN_CHECK
     /* Optionally check input matrices for NaNs */
-    if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
-        return -7;
-    }
     if( LAPACKE_c_nancheck( 1, &alpha, 1 ) ) {
         return -5;
     }
@@ -54,5 +58,6 @@ lapack_int LAPACKE_claset( int matrix_layout, char uplo, lapack_int m,
         return -6;
     }
 #endif
+
     return LAPACKE_claset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda );
 }
index 0003f3d..058a692 100644 (file)
@@ -37,15 +37,18 @@ lapack_int LAPACKE_dlaset( int matrix_layout, char uplo, lapack_int m,
                            lapack_int n, double alpha, double beta, double* a,
                            lapack_int lda )
 {
+
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_dlaset", -1 );
         return -1;
     }
+
+/*****************************************************************************
+*  Note: we do not check NaNs in A since the goal of this subroutine is to 
+*  initialized A. It is OK if A has NaNs in input. 
+*****************************************************************************/
+
 #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;
     }
@@ -53,5 +56,6 @@ lapack_int LAPACKE_dlaset( int matrix_layout, char uplo, lapack_int m,
         return -6;
     }
 #endif
+
     return LAPACKE_dlaset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda );
 }
index 2372913..8646189 100644 (file)
@@ -37,15 +37,19 @@ lapack_int LAPACKE_slaset( int matrix_layout, char uplo, lapack_int m,
                            lapack_int n, float alpha, float beta, float* a,
                            lapack_int lda )
 {
+
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_slaset", -1 );
         return -1;
     }
+
+/*****************************************************************************
+*  Note: we do not check NaNs in A since the goal of this subroutine is to 
+*  initialized A. It is OK if A has NaNs in input. 
+*****************************************************************************/
+
 #ifndef LAPACK_DISABLE_NAN_CHECK
     /* Optionally check input matrices for NaNs */
-    if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) {
-        return -7;
-    }
     if( LAPACKE_s_nancheck( 1, &alpha, 1 ) ) {
         return -5;
     }
@@ -53,5 +57,6 @@ lapack_int LAPACKE_slaset( int matrix_layout, char uplo, lapack_int m,
         return -6;
     }
 #endif
+
     return LAPACKE_slaset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda );
 }
index 9b4725b..47f2f0f 100644 (file)
@@ -38,15 +38,20 @@ lapack_int LAPACKE_zlaset( int matrix_layout, char uplo, lapack_int m,
                            lapack_complex_double beta, lapack_complex_double* a,
                            lapack_int lda )
 {
+
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_zlaset", -1 );
         return -1;
     }
+
+/*****************************************************************************
+*  Note: we do not check NaNs in A since the goal of this subroutine is to 
+*  initialized A. It is OK if A has NaNs in input. 
+*****************************************************************************/
+
+
 #ifndef LAPACK_DISABLE_NAN_CHECK
     /* Optionally check input matrices for NaNs */
-    if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
-        return -7;
-    }
     if( LAPACKE_z_nancheck( 1, &alpha, 1 ) ) {
         return -5;
     }
@@ -54,5 +59,6 @@ lapack_int LAPACKE_zlaset( int matrix_layout, char uplo, lapack_int m,
         return -6;
     }
 #endif
+
     return LAPACKE_zlaset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda );
 }
index 59033c1..f81511d 100644 (file)
@@ -77,7 +77,7 @@
 *>          All the diagonal array elements are set to BETA.
 *> \endverbatim
 *>
-*> \param[in,out] A
+*> \param[out] A
 *> \verbatim
 *>          A is COMPLEX array, dimension (LDA,N)
 *>          On entry, the m by n matrix A.
index 1ce3466..cfd9fa5 100644 (file)
@@ -77,7 +77,7 @@
 *>          The constant to which the diagonal elements are to be set.
 *> \endverbatim
 *>
-*> \param[in,out] A
+*> \param[out] A
 *> \verbatim
 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
 *>          On exit, the leading m-by-n submatrix of A is set as follows:
index 034a3b9..ec4026c 100644 (file)
@@ -77,7 +77,7 @@
 *>          The constant to which the diagonal elements are to be set.
 *> \endverbatim
 *>
-*> \param[in,out] A
+*> \param[out] A
 *> \verbatim
 *>          A is REAL array, dimension (LDA,N)
 *>          On exit, the leading m-by-n submatrix of A is set as follows:
index 11f8236..9be76a1 100644 (file)
@@ -77,7 +77,7 @@
 *>          All the diagonal array elements are set to BETA.
 *> \endverbatim
 *>
-*> \param[in,out] A
+*> \param[out] A
 *> \verbatim
 *>          A is COMPLEX*16 array, dimension (LDA,N)
 *>          On entry, the m by n matrix A.