Skip to content

TypeError in jacobian with non-Vector input #1691

@schillic

Description

@schillic

Symbolics.jl/src/diff.jl

Lines 649 to 656 in 28ab409

function jacobian(ops, vars; simplify=false, kwargs...)
ops = vec(scalarize(ops))
if ops isa Vector{Num}
ops = unwrap.(ops)::Vector{SymbolicT}
elseif ops isa Vector{SymbolicT}
else
ops = ops::Vector{eltype(ops)}
end

The method body requires that ops <: Vector, but the signature does not require that. When using an SVector for instance, this method can be used, leading to a TypeError: in typeassert, expected Vector{Num}, got a value of type SVector{2, Num}.

The code was modified here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions