Skip to content

Add banded paths to generic solve #1372

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
22 changes: 9 additions & 13 deletions src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1236,28 +1236,24 @@ function (\)(A::AbstractMatrix, B::AbstractVecOrMat)
require_one_based_indexing(A, B)
m, n = size(A)
if m == n
if istril(A)
if istriu(A)
return Diagonal(A) \ B
elseif istriu(A, -1)
istrium1 = istriu(A, -1)
istril1 = istril(A, 1)
if istril1 && iszero(diagview(A,1)) # istril(A)
if istrium1
if iszero(diagview(A, -1))
return Diagonal(A) \ B
end
return Bidiagonal(A, :L) \ B
else
return LowerTriangular(A) \ B
end
end
if istriu(A)
if istril(A, 1)
if istrium1 && iszero(diagview(A, -1)) # istriu(A)
if istril1
return Bidiagonal(A, :U) \ B
end
return UpperTriangular(A) \ B
end
if isbanded(A, -1, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you get this "for free" with istrium1 && istril1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there were some triangular lu-related test failures for unusual types, so I've removed the triangular branch for now. We may add this back once those issues are resolved.

T = Tridiagonal(A)
if issymmetric(T)
return SymTridiagonal(T) \ B
end
return lu(T) \ B
end
return lu(A) \ B
end
return qr(A, ColumnNorm()) \ B
Expand Down