Skip to content

Commit 2ea2bd9

Browse files
authored
Apply LAPACKE fix for eigenvector transposition in symmetric eigensolvers
from Reference-LAPACK PR 330
1 parent fbb8949 commit 2ea2bd9

12 files changed

+60
-13
lines changed

lapack-netlib/LAPACKE/src/lapacke_cheev_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ lapack_int LAPACKE_cheev_work( int matrix_layout, char jobz, char uplo,
7878
info = info - 1;
7979
}
8080
/* Transpose output matrices */
81-
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
81+
if ( jobz == 'V') {
82+
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
83+
} else {
84+
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
85+
}
8286
/* Release memory and exit */
8387
LAPACKE_free( a_t );
8488
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_cheevd_2stage_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ lapack_int LAPACKE_cheevd_2stage_work( int matrix_layout, char jobz, char uplo,
7979
info = info - 1;
8080
}
8181
/* Transpose output matrices */
82-
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
82+
if ( jobz == 'V') {
83+
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
84+
} else {
85+
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
86+
}
8387
/* Release memory and exit */
8488
LAPACKE_free( a_t );
8589
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_cheevd_work.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ lapack_int LAPACKE_cheevd_work( int matrix_layout, char jobz, char uplo,
7979
info = info - 1;
8080
}
8181
/* Transpose output matrices */
82-
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83-
82+
if ( jobz == 'V') {
83+
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
84+
} else {
85+
LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
86+
}
8487
/* Release memory and exit */
8588
LAPACKE_free( a_t );
8689
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_dsyev_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ lapack_int LAPACKE_dsyev_work( int matrix_layout, char jobz, char uplo,
7272
info = info - 1;
7373
}
7474
/* Transpose output matrices */
75-
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
75+
if ( jobz == 'V') {
76+
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
77+
} else {
78+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
}
7680
/* Release memory and exit */
7781
LAPACKE_free( a_t );
7882
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_dsyevd_2stage_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ lapack_int LAPACKE_dsyevd_2stage_work( int matrix_layout, char jobz, char uplo,
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
if ( jobz == 'V') {
80+
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
81+
} else {
82+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83+
}
8084
/* Release memory and exit */
8185
LAPACKE_free( a_t );
8286
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_dsyevd_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ lapack_int LAPACKE_dsyevd_work( int matrix_layout, char jobz, char uplo,
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
if ( jobz == 'V') {
80+
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
81+
} else {
82+
LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83+
}
8084
/* Release memory and exit */
8185
LAPACKE_free( a_t );
8286
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_ssyev_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ lapack_int LAPACKE_ssyev_work( int matrix_layout, char jobz, char uplo,
7272
info = info - 1;
7373
}
7474
/* Transpose output matrices */
75-
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
75+
if ( jobz == 'V') {
76+
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
77+
} else {
78+
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
}
7680
/* Release memory and exit */
7781
LAPACKE_free( a_t );
7882
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_ssyevd_2stage_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ lapack_int LAPACKE_ssyevd_2stage_work( int matrix_layout, char jobz, char uplo,
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
if ( jobz == 'V') {
80+
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
81+
} else {
82+
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83+
}
8084
/* Release memory and exit */
8185
LAPACKE_free( a_t );
8286
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_ssyevd_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ lapack_int LAPACKE_ssyevd_work( int matrix_layout, char jobz, char uplo,
7676
info = info - 1;
7777
}
7878
/* Transpose output matrices */
79-
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
79+
if ( jobz == 'V') {
80+
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
81+
} else {
82+
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
83+
}
8084
/* Release memory and exit */
8185
LAPACKE_free( a_t );
8286
exit_level_0:

lapack-netlib/LAPACKE/src/lapacke_zheev_work.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ lapack_int LAPACKE_zheev_work( int matrix_layout, char jobz, char uplo,
7878
info = info - 1;
7979
}
8080
/* Transpose output matrices */
81-
LAPACKE_zhe_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
81+
if ( jobz == 'V') {
82+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
83+
} else {
84+
LAPACKE_zhe_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
85+
}
8286
/* Release memory and exit */
8387
LAPACKE_free( a_t );
8488
exit_level_0:

0 commit comments

Comments
 (0)