Skip to content

Commit a95bfb4

Browse files
committed
Make JET happy
1 parent 2e4e25d commit a95bfb4

5 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/implementations/polar.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function _left_polarnewton!(A::AbstractMatrix, W, P = similar(A, (0, 0)); tol =
123123
Rc .= R
124124
Rᴴinv = ldiv!(UpperTriangular(Rc)', one!(Rᴴinv))
125125
else # m == n
126+
Q = nothing
126127
R = A
127128
Rc = view(W, 1:n, 1:n)
128129
Rc .= R
@@ -163,6 +164,7 @@ function _right_polarnewton!(A::AbstractMatrix, Wᴴ, P = similar(A, (0, 0)); to
163164
copy!(Lc, L)
164165
Lᴴinv = ldiv!(LowerTriangular(Lc)', one!(Lᴴinv))
165166
else # m == n
167+
Q = nothing
166168
L = A
167169
Lc = view(Wᴴ, 1:m, 1:m)
168170
Lc .= L

src/implementations/qr.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ function householder_qr!(
141141
(inplaceQ && (computeR || positive || blocksize > 1 || m < n)) &&
142142
throw(ArgumentError("inplace Q only supported if matrix is tall (`m >= n`), R is not required, and using the unblocked algorithm (`blocksize = 1`) with `positive = false`"))
143143

144+
jpvt = Vector{Int}(undef, 0)
145+
τ = Vector{eltype(A)}(undef, 0)
144146
# Compute QR in packed form
145147
if blocksize > 1
146148
nb = min(minmn, blocksize)

src/pullbacks/eig.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,12 @@ function eig_trunc_pullback!(
135135
(n, n) == size(ΔA) || throw(DimensionMismatch())
136136
G = V' * V
137137

138+
VᴴΔV = !iszerotangent(ΔV) ? V' * ΔV : zero(G)
139+
ΔVperp = ΔV - V * inv(G) * VᴴΔV
138140
if !iszerotangent(ΔV)
139141
(n, p) == size(ΔV) || throw(DimensionMismatch())
140-
VᴴΔV = V' * ΔV
141142
check_eig_cotangents(D, VᴴΔV; degeneracy_atol, gauge_atol)
142-
143-
ΔVperp = ΔV - V * inv(G) * VᴴΔV
144143
VᴴΔV .*= conj.(inv_safe.(transpose(D) .- D, degeneracy_atol))
145-
else
146-
VᴴΔV = zero(G)
147144
end
148145

149146
if !iszerotangent(ΔDmat)

src/pullbacks/svd.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function svd_pullback!(
4747
Ur = view(U, :, 1:r)
4848
Vᴴr = view(Vᴴ, 1:r, :)
4949
Sr = view(S, 1:r)
50+
indU = axes(U, 2)
51+
indV = axes(Vᴴ, 1)
5052

5153
# Extract and check the cotangents
5254
ΔU, ΔSmat, ΔVᴴ = ΔUSVᴴ

src/yalapack.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,14 +2033,15 @@ for (gesvd, gesdd, gesvdx, gejsv, gesvj, elty, relty) in
20332033
for i in 1:2 # first call returns lwork as work[1]
20342034
#! format: off
20352035
if eltype(A) <: Complex
2036+
rwork_ = isnothing(rwork) ? Vector{$relty}(undef, 0) : rwork
20362037
ccall((@blasfunc($gesvd), libblastrampoline), Cvoid,
20372038
(Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{$elty}, Ref{BlasInt},
20382039
Ptr{$relty}, Ptr{$elty}, Ref{BlasInt}, Ptr{$elty}, Ref{BlasInt},
20392040
Ptr{$elty}, Ref{BlasInt}, Ptr{$relty},
20402041
Ptr{BlasInt}, Clong, Clong),
20412042
jobu, jobvt, m, n, A, lda,
20422043
S, U, ldu, Vᴴ, ldv,
2043-
work, lwork, rwork,
2044+
work, lwork, rwork_,
20442045
info, 1, 1)
20452046
else
20462047
ccall((@blasfunc($gesvd), libblastrampoline), Cvoid,
@@ -2135,14 +2136,15 @@ for (gesvd, gesdd, gesvdx, gejsv, gesvj, elty, relty) in
21352136
for i in 1:2 # first call returns lwork as work[1]
21362137
#! format: off
21372138
if eltype(A) <: Complex
2139+
rwork_ = isnothing(rwork) ? Vector{$relty}(undef, 0) : rwork
21382140
ccall((@blasfunc($gesdd), libblastrampoline), Cvoid,
21392141
(Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{$elty}, Ref{BlasInt},
21402142
Ptr{$relty}, Ptr{$elty}, Ref{BlasInt}, Ptr{$elty}, Ref{BlasInt},
21412143
Ptr{$elty}, Ref{BlasInt}, Ptr{$relty}, Ptr{BlasInt},
21422144
Ptr{BlasInt}, Clong),
21432145
job, m, n, A, lda,
21442146
S, U, ldu, Vᴴ, ldv,
2145-
work, lwork, rwork, iwork,
2147+
work, lwork, rwork_, iwork,
21462148
info, 1)
21472149
else
21482150
ccall((@blasfunc($gesdd), libblastrampoline), Cvoid,

0 commit comments

Comments
 (0)