-
Notifications
You must be signed in to change notification settings - Fork 7
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
Diagonality and bandedness checks with InfiniteArrays.jl? #56
Comments
This should be added to BandedMatrices.jl, but note we need to check off-diagonal bands too: julia> isdiag(zeros(5,5))
true something like function isdiag(A::AbstractBandedMatrix)
bandwidths(A) == (0,0) && return true
Base.invoke(isdiag, Tuple{AbstractMatrix}, A)
end julia> InfiniteArrays.Diagonal(1:∞) isa InfiniteLinearAlgebra.BandedMatrix
false This isn't changeble since |
Actually, note function istriu(A::LayoutMatrix, k::Integer = 0)
require_one_based_indexing(A)
m, n = size(A)
for j in 1:min(n, m + k - 1)
for i in (max(1, j - k + 1):m) ∩ colsupport(A,j)
iszero(A[i, j]) || return false
end
end
return true
end and similar for |
@TSGut do you want to have a go making a PR for this? |
Sure. You said you think it would fit into BandedMatrices.jl? EDIT: Actually just saw you also mentioned ArrayLayouts.jl. I suppose I'll try to get it working and passing tests for now. I'll submit the PR to the package you think it would most fit into, so just let me know. |
Hmm actually you could just put it in BandedMatrices.jl since we can do it a bit smarter by adding: function istriu(A::AbstractBandedMatrix, k::Integer)
l,_ = bandwidths(A)
-l ≥ k && return true
...
end |
The methods in InfiniteArrays.jl and InfiniteLinearAlgebra.jl don't currently seem to agree on what is a diagonal and what is a banded matrix. To give some concrete examples:
A minimal working example for Diagonal is
but the following never finishes computing, i.e. does not even return false:
Furthermore, we have a similar situation for banded matrix types:
What one wants these to evaluate to might be up to the design philosophy between the packages to some degree but the current behavior does seem odd.
The text was updated successfully, but these errors were encountered: