From 834c77d1a4f44529db3da798dee8d99ff2790770 Mon Sep 17 00:00:00 2001 From: langou Date: Wed, 28 Oct 2015 02:35:58 +0000 Subject: [PATCH] Remove NaN check from LAPACKE_?laswp and add a comment on why the NaN check is removed. This might not be the best fix but this will do for now. Current behavior: LAPACKE_?laswp does not check for NaNs. See: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4827 for more information. Thanks to Dmitry Baksheev from Intel. --- LAPACKE/src/lapacke_claswp.c | 9 +++++++++ LAPACKE/src/lapacke_dlaswp.c | 9 +++++++++ LAPACKE/src/lapacke_slaswp.c | 9 +++++++++ LAPACKE/src/lapacke_zlaswp.c | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/LAPACKE/src/lapacke_claswp.c b/LAPACKE/src/lapacke_claswp.c index 173a7bf..78d9f6b 100644 --- a/LAPACKE/src/lapacke_claswp.c +++ b/LAPACKE/src/lapacke_claswp.c @@ -44,9 +44,18 @@ lapack_int LAPACKE_claswp( int matrix_layout, lapack_int n, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ +/***************************************************************************** +* Disable the check as is below, the check below was checking for NaN +* from lda to n since there is no (obvious) way to knowing m. This is not +* a good idea. We could get a lower bound of m by scanning from ipiv. Or +* we could pass on the NaN check to LAPACKE_dlaswp_work. For now disable +* the buggy Nan check. +* See forum: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4827 +***************************************************************************** if( LAPACKE_cge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -3; } +*****************************************************************************/ #endif return LAPACKE_claswp_work( matrix_layout, n, a, lda, k1, k2, ipiv, incx ); } diff --git a/LAPACKE/src/lapacke_dlaswp.c b/LAPACKE/src/lapacke_dlaswp.c index 4c55332..dd7533a 100644 --- a/LAPACKE/src/lapacke_dlaswp.c +++ b/LAPACKE/src/lapacke_dlaswp.c @@ -43,9 +43,18 @@ lapack_int LAPACKE_dlaswp( int matrix_layout, lapack_int n, double* a, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ +/***************************************************************************** +* Disable the check as is below, the check below was checking for NaN +* from lda to n since there is no (obvious) way to knowing m. This is not +* a good idea. We could get a lower bound of m by scanning from ipiv. Or +* we could pass on the NaN check to LAPACKE_dlaswp_work. For now disable +* the buggy Nan check. +* See forum: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4827 +***************************************************************************** if( LAPACKE_dge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -3; } +*****************************************************************************/ #endif return LAPACKE_dlaswp_work( matrix_layout, n, a, lda, k1, k2, ipiv, incx ); } diff --git a/LAPACKE/src/lapacke_slaswp.c b/LAPACKE/src/lapacke_slaswp.c index fffa0cb..e18a4bf 100644 --- a/LAPACKE/src/lapacke_slaswp.c +++ b/LAPACKE/src/lapacke_slaswp.c @@ -43,9 +43,18 @@ lapack_int LAPACKE_slaswp( int matrix_layout, lapack_int n, float* a, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ +/***************************************************************************** +* Disable the check as is below, the check below was checking for NaN +* from lda to n since there is no (obvious) way to knowing m. This is not +* a good idea. We could get a lower bound of m by scanning from ipiv. Or +* we could pass on the NaN check to LAPACKE_dlaswp_work. For now disable +* the buggy Nan check. +* See forum: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4827 +***************************************************************************** if( LAPACKE_sge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -3; } +*****************************************************************************/ #endif return LAPACKE_slaswp_work( matrix_layout, n, a, lda, k1, k2, ipiv, incx ); } diff --git a/LAPACKE/src/lapacke_zlaswp.c b/LAPACKE/src/lapacke_zlaswp.c index 765e35a..74ecab7 100644 --- a/LAPACKE/src/lapacke_zlaswp.c +++ b/LAPACKE/src/lapacke_zlaswp.c @@ -44,9 +44,18 @@ lapack_int LAPACKE_zlaswp( int matrix_layout, lapack_int n, } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ +/***************************************************************************** +* Disable the check as is below, the check below was checking for NaN +* from lda to n since there is no (obvious) way to knowing m. This is not +* a good idea. We could get a lower bound of m by scanning from ipiv. Or +* we could pass on the NaN check to LAPACKE_dlaswp_work. For now disable +* the buggy Nan check. +* See forum: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=4827 +***************************************************************************** if( LAPACKE_zge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -3; } +*****************************************************************************/ #endif return LAPACKE_zlaswp_work( matrix_layout, n, a, lda, k1, k2, ipiv, incx ); } -- 2.7.4