-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
If I want to have a multi-dimensional sparse array. I could define
using Symbolics
using SparseArrayKit
@variables a
A = SparseArray{Num}(undef, (1,2,3)) #3dimesional array with size 1, 2, and 3 each
A[1,1,1] = a
But this gives the well-known error
ERROR: TypeError: non-boolean used in boolean context
This is due to the fact that in line #34 of sparsearray.jl we have the zero-comparison if v != zero(v).
This however fails for symbolic expressions as == or != defines an equation.
In this context, one should use if v !== zero(v) to evaluate the expression. Then everything works and still works for regular numbers.
Metadata
Metadata
Assignees
Labels
No labels