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

Make getindex for Bidiagonal O(1) in the worst-case #32329

Merged
merged 1 commit into from
Jul 6, 2019
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
make getindex O(1) worst-case
  • Loading branch information
mcognetta committed Jun 15, 2019
commit cc025d0bce72e2a2783f724a2e5c38490d0bf363
6 changes: 4 additions & 2 deletions stdlib/LinearAlgebra/src/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ function getindex(A::Bidiagonal{T}, i::Integer, j::Integer) where T
end
if i == j
return A.dv[i]
elseif (istriu(A) && (i == j - 1)) || (istril(A) && (i == j + 1))
return A.ev[min(i,j)]
elseif A.uplo == 'U' && (i == j - 1)
return A.ev[i]
elseif A.uplo == 'L' && (i == j + 1)
return A.ev[j]
else
return zero(T)
end
Expand Down