Skip to content

Commit

Permalink
Handle corner cases of LWORK (Reference-LAPACK PR 942)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-frbg authored Dec 23, 2023
1 parent 8ce44c1 commit 5c11b2f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
7 changes: 3 additions & 4 deletions lapack-netlib/TESTING/LIN/cchkhe_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ SUBROUTINE CCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
* block factorization, LWORK is the length of AINV.
*
SRNAMT = 'CHETRF_AA_2STAGE'
LWORK = MIN(N*NB, 3*NMAX*NMAX)
CALL CHETRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, (3*NB+1)*N,
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX)
CALL CHETRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ WORK, LWORK,
$ INFO )
Expand Down Expand Up @@ -517,7 +517,6 @@ SUBROUTINE CCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
*
SRNAMT = 'CHETRS_AA_2STAGE'
LWORK = MAX( 1, 3*N-2 )
CALL CHETRS_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N, IWORK, IWORK( 1+N ),
$ X, LDA, INFO )
Expand Down
4 changes: 2 additions & 2 deletions lapack-netlib/TESTING/LIN/cdrvhe_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ SUBROUTINE CDRVHE_AA_2STAGE(
* Factor the matrix and solve the system using CHESV_AA.
*
SRNAMT = 'CHESV_AA_2STAGE '
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX)
CALL CHESV_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ X, LDA, WORK, LWORK, INFO )
*
Expand Down
5 changes: 2 additions & 3 deletions lapack-netlib/TESTING/LIN/dchksy_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ SUBROUTINE DCHKSY_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
* block factorization, LWORK is the length of AINV.
*
SRNAMT = 'DSYTRF_AA_2STAGE'
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL DSYTRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ WORK, LWORK,
$ INFO )
Expand Down Expand Up @@ -503,7 +503,6 @@ SUBROUTINE DCHKSY_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
CALL DLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
*
SRNAMT = 'DSYTRS_AA_2STAGE'
LWORK = MAX( 1, 3*N-2 )
CALL DSYTRS_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N, IWORK, IWORK( 1+N ),
$ X, LDA, INFO )
Expand Down
4 changes: 2 additions & 2 deletions lapack-netlib/TESTING/LIN/ddrvsy_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ SUBROUTINE DDRVSY_AA_2STAGE(
* Factor the matrix and solve the system using DSYSV_AA.
*
SRNAMT = 'DSYSV_AA_2STAGE '
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL DSYSV_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ X, LDA, WORK, LWORK, INFO )
*
Expand Down
5 changes: 2 additions & 3 deletions lapack-netlib/TESTING/LIN/schksy_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ SUBROUTINE SCHKSY_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
* block factorization, LWORK is the length of AINV.
*
SRNAMT = 'SSYTRF_AA_2STAGE'
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL SSYTRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ WORK, LWORK,
$ INFO )
Expand Down Expand Up @@ -505,7 +505,6 @@ SUBROUTINE SCHKSY_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
CALL SLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
*
SRNAMT = 'SSYTRS_AA_2STAGE'
LWORK = MAX( 1, 3*N-2 )
CALL SSYTRS_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N, IWORK, IWORK( 1+N ),
$ X, LDA, INFO )
Expand Down
4 changes: 2 additions & 2 deletions lapack-netlib/TESTING/LIN/sdrvsy_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ SUBROUTINE SDRVSY_AA_2STAGE(
* Factor the matrix and solve the system using SSYSV_AA.
*
SRNAMT = 'SSYSV_AA_2STAGE '
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL SSYSV_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ X, LDA, WORK, LWORK, INFO )
*
Expand Down
11 changes: 6 additions & 5 deletions lapack-netlib/TESTING/LIN/zchkhe_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Definition:
* ===========
*
* SUBROUTINE ZCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL,
* SUBROUTINE ZCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL,
* NNS, NSVAL, THRESH, TSTERR, NMAX, A,
* AFAC, AINV, B, X, XACT, WORK, RWORK,
* IWORK, NOUT )
Expand Down Expand Up @@ -185,7 +185,8 @@ SUBROUTINE ZCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
LOGICAL DOTYPE( * )
INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
$ RWORK( * ), WORK( * ), X( * ), XACT( * )
$ WORK( * ), X( * ), XACT( * )
DOUBLE PRECISION RWORK( * )
* ..
*
* =====================================================================
Expand Down Expand Up @@ -430,9 +431,9 @@ SUBROUTINE ZCHKHE_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
* block factorization, LWORK is the length of AINV.
*
SRNAMT = 'ZHETRF_AA_2STAGE'
LWORK = MIN(N*NB, 3*NMAX*NMAX)
CALL ZHETRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, (3*NB+1)*N,
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL ZHETRF_AA_2STAGE( UPLO, N, AFAC, LDA,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ WORK, LWORK,
$ INFO )
Expand Down
4 changes: 2 additions & 2 deletions lapack-netlib/TESTING/LIN/zdrvhe_aa_2stage.f
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ SUBROUTINE ZDRVHE_AA_2STAGE(
* Factor the matrix and solve the system using ZHESV_AA.
*
SRNAMT = 'ZHESV_AA_2STAGE '
LWORK = MIN(N*NB, 3*NMAX*NMAX)
LWORK = MIN( MAX( 1, N*NB ), 3*NMAX*NMAX )
CALL ZHESV_AA_2STAGE( UPLO, N, NRHS, AFAC, LDA,
$ AINV, (3*NB+1)*N,
$ AINV, MAX( 1, (3*NB+1)*N ),
$ IWORK, IWORK( 1+N ),
$ X, LDA, WORK, LWORK, INFO )
*
Expand Down

0 comments on commit 5c11b2f

Please sign in to comment.