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

SparseArray layouts? #74

Open
orenbenkiki opened this issue Sep 7, 2021 · 2 comments
Open

SparseArray layouts? #74

orenbenkiki opened this issue Sep 7, 2021 · 2 comments

Comments

@orenbenkiki
Copy link

Any chance of seeing SparseRowMajor and SparseColumnMajor layout support?

@dlfivefifty
Copy link
Member

Would love to have that, though I don’t know what SparseColumnMajor means…

@orenbenkiki
Copy link
Author

It means it is more efficient to slice or work on the matrix column-by-column rather than row-by row. That is, the value of it would be in SparseColumnMajor <: AbstractColumnMajor.

BTW - as long as I'm wishing - how about supporting ReadOnlyArrays? Right now they are all reported as UnknownLayout regardless of the internal representation.

My use case is very focused on the question of the efficient access pattern for a matrix, that is, whether it is row-major, column-major, or neither. Since I do a lot of specific processing operations on my not-small matrices (sometimes, memory mapped), if they aren't in the "efficient" layout I re-layout them into a more efficient layout and only then start the processing (this isn't linear algebra, it is more of a "data frame" type of processing - statistics on each row or column, downsampling, slicing, etc.). I do have to pay the cost of doing the physical re-layouting once, and doubles the memory/disk usage, but this pays for itself very quickly when doing multiple such operations.

Speaking of which, is there an official way today to create an identical matrix to a given one, but with the opposite layout? E.g. convert a SparseMatrixCSC (column-major) to a Transpose{SparseMatrixCSC} (row-major) with the exact same size and content?

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

2 participants