-
Notifications
You must be signed in to change notification settings - Fork 17
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
FunctionLens for SparseMatrixCSC accessor functions #78
Comments
Yeah sounds good. I guess this is a case, where you would really like to have a mutating |
nonzeros(A) .= xs A concrete scenario I have in mind is to construct CSC matrices with shared nonzero structure like this B = spzeros(size(A)...)
@set coloffsets(B) = coloffsets(A)
@set rowvals(B) = rowvals(A)
@set nonzeros(B) = similar(nonzeros(A))
compute!(nonzeros(B)) In this case, the above lens does what I need. A scenario I can think of where the mutating lens is usable is something like A = sprandn(ComplexF64, 100, 100, 0.1)
B = @set!! real(nonzeros(A)[1]) = x where you'd want it to do a = nonzeros(A)
b = a[1]
c = @set b.re = x
a[1] = c # typeof(c) == typeof(b) so mutate `a`
B = @set nonzeros(A) = a # `A` is immutable so use normal lens |
I see thanks. Out of curiosity, do you want to share nonzero structure for PDE discretization? |
It's sparse (somewhat biological) neural network simulation. I found fusing |
Once
AbstractSparseMatrixCSC
API for accessors JuliaLang/julia#33054 is settled, I'd like to addset
definitions for them. It'll let us use something likeThe definition would be something like simply
@jw3126 Does it sound reasonable?
The text was updated successfully, but these errors were encountered: