We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
LoadError: MethodError: no method matching _sparse(::SymbolicUtils.BasicSymbolic{Any}, ::Int64)
I tried the following code:
using Symbolics, IfElse f(x) = Base.ifelse( # IfElse.ifelse doesn't work either x[1] <= 0, -x[1], x[1], ) x0 = ones(1) nvar = 1 @variables xs[1:nvar] xsi = Symbolics.scalarize(xs) fun = f(xsi) S = Symbolics.hessian_sparsity(fun, xsi)
and got the following error
ERROR: LoadError: MethodError: no method matching _sparse(::SymbolicUtils.BasicSymbolic{Any}, ::Int64) Closest candidates are: _sparse(::Number, ::Any) at .julia\packages\Symbolics\gy00O\src\linearity.jl:170 _sparse(::Symbolics.TermCombination, ::Any) at .julia\packages\Symbolics\gy00O\src\linearity.jl:147 Stacktrace: [1] hessian_sparsity(expr::Num, vars::Vector{Num}; full::Bool) @ Symbolics .julia\packages\Symbolics\gy00O\src\diff.jl:679 [2] hessian_sparsity(expr::Num, vars::Vector{Num}) @ Symbolics .julia\packages\Symbolics\gy00O\src\diff.jl:671
It might be related to #888 .
The text was updated successfully, but these errors were encountered:
Sorry, but it's unclear to me what are you trying to achieve here? Isn't ifelse(x <= 0, -x, x) just abs(x), which is non-differentiable?
ifelse(x <= 0, -x, x)
abs(x)
Sorry, something went wrong.
@aravindh-krishnamoorthy you are right, let me reformulate the example. The error is the same if the function is differentiable as follows:
using Symbolics f(x) = Base.ifelse( x[1] <= 0, -x[1]^2, x[1]^2, ) x0 = ones(1) nvar = 1 @variables xs[1:nvar] xsi = Symbolics.scalarize(xs) fun = f(xsi) S = Symbolics.hessian_sparsity(fun, xsi)
@shashi do you know what's going on in this one?
No branches or pull requests
I tried the following code:
and got the following error
It might be related to #888 .
The text was updated successfully, but these errors were encountered: