Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Structured Matrix Detection #8

Open
ChrisRackauckas opened this issue Oct 31, 2019 · 5 comments
Open

Structured Matrix Detection #8

ChrisRackauckas opened this issue Oct 31, 2019 · 5 comments

Comments

@ChrisRackauckas
Copy link
Member

If the sparse matrix actually has structure, it would be nice to have a way to detect that and return the structured matrix type.

@shashi
Copy link
Collaborator

shashi commented Feb 6, 2020

If the sparse matrix actually has structure

Which matrix? :-)

@ChrisRackauckas
Copy link
Member Author

I think it's just determine_structure(A::SparseMatrixCSC). Completely not type-stable of course, but analyses the sparsity pattern and spits out the matrix type.

@shashi
Copy link
Collaborator

shashi commented Feb 6, 2020

Does anyone have that function somewhere?

@ChrisRackauckas
Copy link
Member Author

Not that I know of. There are pieces of it in factorize:

https://github.com/JuliaLang/julia/blob/2fcb1b16fc734be41ebf348ddfe37809b081f027/stdlib/LinearAlgebra/src/dense.jl#L1196-L1224

I'd also want to catch if it's Banded, BlockBanded, or BandedBlockBanded. @dlfivefifty are constructors from sparse matrices implemented anywhere for those?

@dlfivefifty
Copy link

Constructors to sparse are implemented (sparse(::BandedMatrix)). From sparse is not but should be pretty easy, at least for banded: only need to overload bandwidths(A::SparseMatrixCSC). Something like this (though should be rewritten not to allocate):

function bandwidths(A::SparseMatrixCSC)
    Is, Js = ??? # Don't remember how to get the I and J indices from a sparse matrix
    maximum(Is - Js),maximum(Js - Is)
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants