Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid constprop in syevd! and syev! #56442

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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