Skip to content

Commit

Permalink
Avoid constprop in syevd and syev!
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Nov 4, 2024
1 parent 50713ee commit 3ae7158
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions stdlib/LinearAlgebra/src/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5318,6 +5318,14 @@ solution `X`.
"""
hetrs!(uplo::AbstractChar, A::AbstractMatrix, ipiv::AbstractVector{BlasInt}, B::AbstractVecOrMat)

for f in (:syevd!, :syev!)
_f = Symbol(:_, f)
@eval function $f(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix)
W, A = $_f(jobz, uplo, A)
jobz == 'V' ? (W, A) : W
end
end

# Symmetric (real) eigensolvers
for (syev, syevr, syevd, sygvd, elty) in
((:dsyev_,:dsyevr_,:dsyevd_,:dsygvd_,:Float64),
Expand All @@ -5329,7 +5337,7 @@ for (syev, syevr, syevd, sygvd, elty) in
# INTEGER INFO, LDA, LWORK, N
# * .. Array Arguments ..
# DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
Base.@constprop :aggressive function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :none function _syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkuplo(uplo)
Expand All @@ -5350,7 +5358,7 @@ for (syev, syevr, syevd, sygvd, elty) in
resize!(work, lwork)
end
end
jobz == 'V' ? (W, A) : W
W, A
end

# SUBROUTINE DSYEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
Expand Down Expand Up @@ -5429,7 +5437,7 @@ for (syev, syevr, syevd, sygvd, elty) in
# * .. Array Arguments ..
# INTEGER IWORK( * )
# DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
Base.@constprop :aggressive function syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :none function _syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkstride1(A)
Expand Down Expand Up @@ -5459,7 +5467,7 @@ for (syev, syevr, syevd, sygvd, elty) in
resize!(iwork, liwork)
end
end
jobz == 'V' ? (W, A) : W
W, A
end

# Generalized eigenproblem
Expand Down Expand Up @@ -5526,7 +5534,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
# * .. Array Arguments ..
# DOUBLE PRECISION RWORK( * ), W( * )
# COMPLEX*16 A( LDA, * ), WORK( * )
Base.@constprop :aggressive function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :none function _syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkstride1(A)
Expand All @@ -5550,7 +5558,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
resize!(work, lwork)
end
end
jobz == 'V' ? (W, A) : W
W, A
end

# SUBROUTINE ZHEEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
Expand Down Expand Up @@ -5639,7 +5647,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
# INTEGER IWORK( * )
# DOUBLE PRECISION RWORK( * )
# COMPLEX*16 A( LDA, * ), WORK( * )
Base.@constprop :aggressive function syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :none function _syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkstride1(A)
Expand Down Expand Up @@ -5673,7 +5681,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
resize!(iwork, liwork)
end
end
jobz == 'V' ? (W, A) : W
W, A
end

# SUBROUTINE ZHEGVD( ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK,
Expand Down

0 comments on commit 3ae7158

Please sign in to comment.