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

Specify behaviour of map for sparse matrices #7157

Closed
jumutc opened this issue Jun 6, 2014 · 6 comments
Closed

Specify behaviour of map for sparse matrices #7157

jumutc opened this issue Jun 6, 2014 · 6 comments
Labels
Milestone

Comments

@jumutc
Copy link

jumutc commented Jun 6, 2014

We need a solid and unambiguous behaviour of map for sparse matrices which would preserve sparse structure and keep the memory and computational burden small. Please consider conversation related to issue: #6918.

@nalimilan
Copy link
Member

If pure declarations were supported (#414), map could be restricted to pure functions when applied to sparse arrays, which would allow assuming that f(0) returns always the same value, and thus checking only once that f(0) == 0 (else error out).

@johnmyleswhite
Copy link
Member

As long as pure implies deterministic, I agree that the relevant restriction is that map needs to be restricted to pure functions.

@tkelman
Copy link
Contributor

tkelman commented Jun 12, 2014

This seems like a lot of extra checking and special-casing for something that's not all that hard to do manually. Rather than trying to enforce extra requirements on the general-purpose map for sparse matrices, why not put in a helper function spmap or something that operates only on (structural) nonzeros, returns an output with the same sparsity pattern, but doesn't impose any extra checks or requirements on the function. This would be quite simple to write by hand, just a few lines of code, if it's something you find yourself doing often.

@StefanKarpinski
Copy link
Sponsor Member

Excellent idea.

@jumutc
Copy link
Author

jumutc commented Jun 16, 2014

I would consider operations over non-zero entries of SparseMatrixCSC as a common use case which shouldn't be duplicated over and over again. May be something like spmap is a good idea but it should belong to sparse.jl.

@ViralBShah
Copy link
Member

Closing as dup of #7010

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

No branches or pull requests

6 participants