-
Notifications
You must be signed in to change notification settings - Fork 10
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
Redirect broadcasted setindex via fill!
#372
Comments
We could technically throw an error in |
alternatively within set_mlir_data we could do the corresponding fixes. For example here, we would say (in psedocode)
|
The above is not legal in Julia since UpperTriangular can't have non-zero entries in the lower triangular part. But the way we implement |
|
I agree structurally it doesn't have non-zero entries there, but the parent itself actually might, so in order to store the data into the parent (the only legal possibility), then we have to fuse the existing entries, with the new ones |
All operations expect direct setindexing is allowed: julia> y .= 1
ERROR: ArgumentError: cannot set indices in the lower triangular part of an UpperTriangular matrix to a nonzero value (1)
Stacktrace:
[1] throw_setindex_structuralzero_error(T::Type, x::Any)
@ LinearAlgebra ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/triangular.jl:347
[2] fill!
@ ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/triangular.jl:352 [inlined]
[3] copyto!
@ ./broadcast.jl:928 [inlined]
[4] materialize!
@ ./broadcast.jl:878 [inlined]
[5] materialize!(dest::UpperTriangular{Float64, Matrix{Float64}}, bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(identity), Tuple{Int64}})
@ Base.Broadcast ./broadcast.jl:875
[6] top-level scope
@ REPL[7]:1
[7] top-level scope
@ none:1 |
That is why, I feel redirecting the setindex via |
Fair enough, (and I have no strong opinions here). Go for it! |
currently, it is legal to do:
in Reactant. This technically needs #369 to work but that PR is not adding the setindex functionality.
The text was updated successfully, but these errors were encountered: