From 6b20fd0bfc3f7ac36e7074b2afa3a8683c2dab46 Mon Sep 17 00:00:00 2001 From: langou Date: Wed, 26 Aug 2015 04:42:47 +0000 Subject: [PATCH] correcting bug 128 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 | 11 ++++++++--- LAPACKE/src/lapacke_dlaset.c | 12 ++++++++---- LAPACKE/src/lapacke_slaset.c | 11 ++++++++--- LAPACKE/src/lapacke_zlaset.c | 12 +++++++++--- SRC/claset.f | 2 +- SRC/dlaset.f | 2 +- SRC/slaset.f | 2 +- SRC/zlaset.f | 2 +- 8 files changed, 37 insertions(+), 17 deletions(-) diff --git a/LAPACKE/src/lapacke_claset.c b/LAPACKE/src/lapacke_claset.c index 2dfaf671..50a43fad 100644 --- a/LAPACKE/src/lapacke_claset.c +++ b/LAPACKE/src/lapacke_claset.c @@ -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 ); } diff --git a/LAPACKE/src/lapacke_dlaset.c b/LAPACKE/src/lapacke_dlaset.c index 0003f3d7..058a6923 100644 --- a/LAPACKE/src/lapacke_dlaset.c +++ b/LAPACKE/src/lapacke_dlaset.c @@ -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 ); } diff --git a/LAPACKE/src/lapacke_slaset.c b/LAPACKE/src/lapacke_slaset.c index 2372913e..86461895 100644 --- a/LAPACKE/src/lapacke_slaset.c +++ b/LAPACKE/src/lapacke_slaset.c @@ -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 ); } diff --git a/LAPACKE/src/lapacke_zlaset.c b/LAPACKE/src/lapacke_zlaset.c index 9b4725be..47f2f0f4 100644 --- a/LAPACKE/src/lapacke_zlaset.c +++ b/LAPACKE/src/lapacke_zlaset.c @@ -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 ); } diff --git a/SRC/claset.f b/SRC/claset.f index 59033c1a..f81511d8 100644 --- a/SRC/claset.f +++ b/SRC/claset.f @@ -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. diff --git a/SRC/dlaset.f b/SRC/dlaset.f index 1ce34662..cfd9fa5c 100644 --- a/SRC/dlaset.f +++ b/SRC/dlaset.f @@ -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: diff --git a/SRC/slaset.f b/SRC/slaset.f index 034a3b97..ec4026ca 100644 --- a/SRC/slaset.f +++ b/SRC/slaset.f @@ -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: diff --git a/SRC/zlaset.f b/SRC/zlaset.f index 11f82361..9be76a1b 100644 --- a/SRC/zlaset.f +++ b/SRC/zlaset.f @@ -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. -- 2.34.1