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

LAPACK: Aggressive constprop to concretely infer syev!/syevd! #55295

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions stdlib/LinearAlgebra/src/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5329,7 +5329,7 @@ for (syev, syevr, syevd, sygvd, elty) in
# INTEGER INFO, LDA, LWORK, N
# * .. Array Arguments ..
# DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :aggressive function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkuplo(uplo)
Expand Down Expand Up @@ -5429,7 +5429,7 @@ for (syev, syevr, syevd, sygvd, elty) in
# * .. Array Arguments ..
# INTEGER IWORK( * )
# DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
function syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :aggressive 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 @@ -5526,7 +5526,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
# * .. Array Arguments ..
# DOUBLE PRECISION RWORK( * ), W( * )
# COMPLEX*16 A( LDA, * ), WORK( * )
function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :aggressive function syev!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkstride1(A)
Expand Down Expand Up @@ -5639,7 +5639,7 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
# INTEGER IWORK( * )
# DOUBLE PRECISION RWORK( * )
# COMPLEX*16 A( LDA, * ), WORK( * )
function syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
Base.@constprop :aggressive function syevd!(jobz::AbstractChar, uplo::AbstractChar, A::AbstractMatrix{$elty})
require_one_based_indexing(A)
@chkvalidparam 1 jobz ('N', 'V')
chkstride1(A)
Expand Down
10 changes: 10 additions & 0 deletions stdlib/LinearAlgebra/test/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -889,4 +889,14 @@ end
@test UpperTriangular(A) == UpperTriangular(B)
end

@testset "inference in syev!/syevd!" begin
for T in (Float32, Float64), CT in (T, Complex{T})
A = rand(CT, 4,4)
@inferred (A -> LAPACK.syev!('N', 'U', A))(A)
@inferred (A -> LAPACK.syev!('V', 'U', A))(A)
@inferred (A -> LAPACK.syevd!('N', 'U', A))(A)
@inferred (A -> LAPACK.syevd!('V', 'U', A))(A)
end
end

end # module TestLAPACK