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

SparseMatrixCSR should be a type alias for Transpose{SparseMatrixCSC} #41

Closed
ndinsmore opened this issue Mar 13, 2019 · 8 comments
Closed

Comments

@ndinsmore
Copy link

I am surprised that this isn't already in SparseArray, but should we define:
const SparseMatrixCSR{Tv,Ti} = Transpose{Tv,SparseMatrix{Tv,Ti}} where {Tv, Ti <: Integer}

This plus a few simple additional methods would make it so Julia had psuedo built in support for compressed sparse matrixes.

I am already using a definition like this and I can't believe that I am the only one.

If people agree I can take a shot at the PR.

@KlausC
Copy link
Contributor

KlausC commented Mar 16, 2019

Do you mean Transpose or Adjoint? Note, that adjoint(transpose(A)) == conj.(A) for complex element type. What would be the benefit of having this constant? There is currently not much support for operations on Transpose{ SparseMatrixCSC}`.

@ndinsmore
Copy link
Author

I was originally using Adjoint but I don't think that it is semantically correct. Since this is basically a data manipulation operation rather than a mathematical one, which I think points to Transpose particularly for data types like complex.

This would necessitate some built out of operations on Transpose{ SparseMatrixCSC} but I would like to think that shouldn't be too excessive.

The benefit would be that it would standardize the ecosystem to using the SparseArrays when the have a problem that necessitates a CSR matrix, rather than an ad-hoc solution. This will also ensure that in those cases users that need CSR will have a solution that this performant out of the box.

@KlausC
Copy link
Contributor

KlausC commented Mar 16, 2019

This would necessitate some built out of operations on Transpose{ SparseMatrixCSC} but I would like to think that shouldn't be too excessive.

It would, believe me. I am working on general wrappers of sparse matrices for a while now. Best what was recently merged into julia1.2 are conversions of wrapped sparse to SparseMatrixCSC in order to be able to call the specialized methods of this type.

@ViralBShah
Copy link
Member

I am inclined to close this one, as a substantial rewrite that results out of this should perhaps be done in an external package.

@ndinsmore
Copy link
Author

I think that at it's simplest this would only be a single lined alias, with a few more lines to for a "constructor function" and convert. Give me a few weeks to put together the basic PR

@ViralBShah
Copy link
Member

If we introduce this, pretty much everything has to work on it and we have to field issues around performance that come up. I would be curious to see how far we can get.

@martinholters
Copy link
Contributor

Is the recursive nature of transpose an obstacle here?

@KristofferC KristofferC transferred this issue from JuliaLang/julia Jan 14, 2022
@ViralBShah
Copy link
Member

I think this can easily be experimented with in a package called SparseMatrixCSR.jl.

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

No branches or pull requests

4 participants