-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
I was working with the Symbolics.jl package recently and it seems mostly to work out of the box.
However converting a Tensor to a SymmetricTensor leads to an error:
A symbolic expression appeared in a Boolean context. This error arises in situations where Julia expects a Bool, like
if boolean_condition use ifelse(boolean_condition, then branch, else branch)
x && y use x & y
boolean_condition ? a : b use ifelse(boolean_condition, a, b)
but a symbolic expression appeared instead of a Bool. For help regarding control flow with symbolic variables, see https://docs.sciml.ai/ModelingToolkit/dev/basics/FAQ/#How-do-I-handle-if-statements-in-my-symbolic-forms?
However that can be easily fixed with
using LinearAlgebra
using Symbolics
LinearAlgebra.issymmetric(t::Tensor{2, 2, Num}) = @inbounds t[1,2] === t[2,1](Note the three =).
If you are interested I could draft up a PR putting this code into an extension, marking it only to be used when Symbolics.jl is also used. If you think that is too user-specific its also fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels