jverzani / SymPyCore.jl

Package to help connect Julia with the SymPy library of Python
https://jverzani.github.io/SymPyCore.jl/
MIT License
5 stars 5 forks source link

Slicing of symbolic arrays #41

Closed michakraus closed 8 months ago

michakraus commented 8 months ago

Element assignment via slicing to symbolic arrays does not seem to work, but only single element assignment:

julia> x = zeros(SymPy.Sym{PyCall.PyObject}, 2, 2)
2×2 Matrix{SymPyCore.Sym{PyCall.PyObject}}:
 0  0
 0  0

julia> x[1,1] = 1; x
2×2 Matrix{SymPyCore.Sym{PyCall.PyObject}}:
 1  0
 0  0

julia> x[2,:] .= 2; x
2×2 Matrix{SymPyCore.Sym{PyCall.PyObject}}:
 1  0
 0  0
jverzani commented 8 months ago

This one seems to be a problem with view. I forget why now, but for some reason views were causing stackoverflows so I essentially disabled them. (https://github.com/jverzani/SymPyCore.jl/blob/main/src/matrix.jl#L11) I'll have to go back and trace over my steps to see if this can be addressed.

michakraus commented 8 months ago

Many thanks for the quick fix! Works fine now.