Skip to content

Commit e0732e7

Browse files
committed
Branch elimination in Bidiagonal indexing with BandIndex
1 parent ec7dcb6 commit e0732e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/LinearAlgebra/src/bidiag.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ end
166166
end
167167

168168
@inline function getindex(A::Bidiagonal{T}, b::BandIndex) where T
169-
@boundscheck checkbounds(A, _cartinds(b))
169+
@boundscheck checkbounds(A, b)
170170
if b.band == 0
171171
return @inbounds A.dv[b.index]
172-
elseif b.band == _offdiagind(A.uplo)
172+
elseif b.band (-1,1) && b.band == _offdiagind(A.uplo)
173+
# we explicitly compare the possible bands as b.band may be constant-propagated
173174
return @inbounds A.ev[b.index]
174175
else
175176
return bidiagzero(A, Tuple(_cartinds(b))...)

0 commit comments

Comments
 (0)