Skip to content

Commit 86f70bd

Browse files
For symmetric eigensolvers only upper or lower triangle of a matrix should be set
and remaining part of matrix can contain any values including NaNs but these LAPACKE symmetric eigensolver drivers checked the whole matrix for NaNs and they used transposition of the whole matrix. The new versions check and transpose upper or lower triangle of matrix.
1 parent a5aad90 commit 86f70bd

19 files changed

Lines changed: 31 additions & 30 deletions

LAPACKE/src/lapacke_cheevd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ lapack_int LAPACKE_cheevd( int matrix_layout, char jobz, char uplo, lapack_int n
5353
#ifndef LAPACK_DISABLE_NAN_CHECK
5454
if( LAPACKE_get_nancheck() ) {
5555
/* Optionally check input matrices for NaNs */
56-
if( LAPACKE_cge_nancheck( matrix_layout, n, n, a, lda ) ) {
56+
if( LAPACKE_che_nancheck( matrix_layout, uplo, n, a, lda ) ) {
5757
return -5;
5858
}
5959
}

LAPACKE/src/lapacke_cheevd_2stage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ lapack_int LAPACKE_cheevd_2stage( int matrix_layout, char jobz, char uplo, lapac
5353
#ifndef LAPACK_DISABLE_NAN_CHECK
5454
if( LAPACKE_get_nancheck() ) {
5555
/* Optionally check input matrices for NaNs */
56-
if( LAPACKE_cge_nancheck( matrix_layout, n, n, a, lda ) ) {
56+
if( LAPACKE_che_nancheck( matrix_layout, uplo, n, a, lda ) ) {
5757
return -5;
5858
}
5959
}

LAPACKE/src/lapacke_cheevd_2stage_work.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ lapack_int LAPACKE_cheevd_2stage_work( int matrix_layout, char jobz, char uplo,
7171
goto exit_level_0;
7272
}
7373
/* Transpose input matrices */
74-
LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
74+
LAPACKE_che_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
7575
/* Call LAPACK function and adjust info */
7676
LAPACK_cheevd_2stage( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, rwork,
7777
&lrwork, iwork, &liwork, &info );
7878
if( info < 0 ) {
7979
info = info - 1;
8080
}
8181
/* Transpose output matrices */
82-
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
82+
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
8383
/* Release memory and exit */
8484
LAPACKE_free( a_t );
8585
exit_level_0:

LAPACKE/src/lapacke_cheevd_work.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,16 @@ lapack_int LAPACKE_cheevd_work( int matrix_layout, char jobz, char uplo,
7171
goto exit_level_0;
7272
}
7373
/* Transpose input matrices */
74-
LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
74+
LAPACKE_che_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
7575
/* Call LAPACK function and adjust info */
7676
LAPACK_cheevd( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, rwork,
7777
&lrwork, iwork, &liwork, &info );
7878
if( info < 0 ) {
7979
info = info - 1;
8080
}
8181
/* Transpose output matrices */
82-
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
82+
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83+
8384
/* Release memory and exit */
8485
LAPACKE_free( a_t );
8586
exit_level_0:

LAPACKE/src/lapacke_dsyev_work.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ lapack_int LAPACKE_dsyev_work( int matrix_layout, char jobz, char uplo,
6565
goto exit_level_0;
6666
}
6767
/* Transpose input matrices */
68-
LAPACKE_dge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
68+
LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
6969
/* Call LAPACK function and adjust info */
7070
LAPACK_dsyev( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, &info );
7171
if( info < 0 ) {
7272
info = info - 1;
7373
}
7474
/* Transpose output matrices */
75-
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
75+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
7676
/* Release memory and exit */
7777
LAPACKE_free( a_t );
7878
exit_level_0:

LAPACKE/src/lapacke_dsyevd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ lapack_int LAPACKE_dsyevd( int matrix_layout, char jobz, char uplo, lapack_int n
5050
#ifndef LAPACK_DISABLE_NAN_CHECK
5151
if( LAPACKE_get_nancheck() ) {
5252
/* Optionally check input matrices for NaNs */
53-
if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
53+
if( LAPACKE_dsy_nancheck( matrix_layout, uplo, n, a, lda ) ) {
5454
return -5;
5555
}
5656
}

LAPACKE/src/lapacke_dsyevd_2stage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ lapack_int LAPACKE_dsyevd_2stage( int matrix_layout, char jobz, char uplo, lapac
5050
#ifndef LAPACK_DISABLE_NAN_CHECK
5151
if( LAPACKE_get_nancheck() ) {
5252
/* Optionally check input matrices for NaNs */
53-
if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
53+
if( LAPACKE_dsy_nancheck( matrix_layout, uplo, n, a, lda ) ) {
5454
return -5;
5555
}
5656
}

LAPACKE/src/lapacke_dsyevd_2stage_work.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ lapack_int LAPACKE_dsyevd_2stage_work( int matrix_layout, char jobz, char uplo,
6868
goto exit_level_0;
6969
}
7070
/* Transpose input matrices */
71-
LAPACKE_dge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
71+
LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
7272
/* Call LAPACK function and adjust info */
7373
LAPACK_dsyevd_2stage( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, iwork,
7474
&liwork, &info );
7575
if( info < 0 ) {
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
79+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
8080
/* Release memory and exit */
8181
LAPACKE_free( a_t );
8282
exit_level_0:

LAPACKE/src/lapacke_dsyevd_work.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ lapack_int LAPACKE_dsyevd_work( int matrix_layout, char jobz, char uplo,
6868
goto exit_level_0;
6969
}
7070
/* Transpose input matrices */
71-
LAPACKE_dge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
71+
LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
7272
/* Call LAPACK function and adjust info */
7373
LAPACK_dsyevd( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, iwork,
7474
&liwork, &info );
7575
if( info < 0 ) {
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
79+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
8080
/* Release memory and exit */
8181
LAPACKE_free( a_t );
8282
exit_level_0:

LAPACKE/src/lapacke_ssyev_work.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ lapack_int LAPACKE_ssyev_work( int matrix_layout, char jobz, char uplo,
6565
goto exit_level_0;
6666
}
6767
/* Transpose input matrices */
68-
LAPACKE_sge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
68+
LAPACKE_ssy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
6969
/* Call LAPACK function and adjust info */
7070
LAPACK_ssyev( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, &info );
7171
if( info < 0 ) {
7272
info = info - 1;
7373
}
7474
/* Transpose output matrices */
75-
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
75+
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
7676
/* Release memory and exit */
7777
LAPACKE_free( a_t );
7878
exit_level_0:

0 commit comments

Comments
 (0)