Skip to content

Call to simulate fails with MethodError (lu on 6x6 SMatrix is ambiguous) #13

@stephane-caron

Description

@stephane-caron

Running Julia 1.7.2 with Dojo v0.1.0, the first steps of the example from Defining a Simulation work so far:

using Dojo
timestep=0.01
gravity=0.0
mech = get_mechanism(:dzhanibekov, timestep=timestep, gravity=gravity);
initialize!(mech, :dzhanibekov, angular_velocity=[15.0; 0.01; 0.0])

But next the simulation fails with the following error:

julia> storage = simulate!(mech, 5.0, record=true, verbose=false)
ERROR: MethodError: lu(::StaticArrays.SMatrix{6, 6, Float64, 36}, ::Val{true}) is ambiguous. Candidates:
  lu(A::AbstractMatrix, ::Val{true}; check) in LinearAlgebra at deprecated.jl:70
  lu(A::StaticArrays.StaticMatrix{N, N}, pivot::Union{Val{false}, Val{true}}; check) where N in StaticArrays at ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:40
  lu(A::StaticArrays.StaticMatrix, pivot::Union{Val{false}, Val{true}}; check) in StaticArrays at ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:33
Possible fix, define
  lu(::StaticArrays.StaticMatrix{N, N}, ::Val{true}) where N
Stacktrace:
  [1] lu(A::StaticArrays.SMatrix{6, 6, Float64, 36})
    @ StaticArrays ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:42
  [2] macro expansion
    @ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:77 [inlined]
  [3] _inv
    @ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:72 [inlined]
  [4] inv
    @ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:5 [inlined]
  [5] ldu_factorization_acyclic!(diagonal_v::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, offdiagonal_l::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, diagonal_c::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, offdiagonal_u::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, diagonal_inverse_c::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}})
    @ Dojo ~/.julia/packages/Dojo/wc2gJ/src/graph/ldu_factorization.jl:6
  [6] ldu_factorization!(system::Dojo.System{4})
    @ Dojo ~/.julia/packages/Dojo/wc2gJ/src/graph/ldu_factorization.jl:38
  [7] mehrotra!(mechanism::Mechanism{Float64, 4, 2, 2, 0}; opts::SolverOptions{Float64})
    @ Dojo ~/.julia/packages/Dojo/wc2gJ/src/solver/mehrotra.jl:36
  [8] simulate!(mechanism::Mechanism{Float64, 4, 2, 2, 0}, steps::Base.OneTo{Int64}, storage::Dojo.Storage{Float64, 500}, control!::Dojo.var"#180#182"; record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
    @ Dojo ~/.julia/packages/Dojo/wc2gJ/src/simulation/simulate.jl:28
  [9] simulate!(::Mechanism{Float64, 4, 2, 2, 0}, ::Float64; record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
    @ Dojo ~/.julia/packages/Dojo/wc2gJ/src/simulation/simulate.jl:46
 [10] top-level scope
    @ REPL[6]:1

This error looks similar to JuliaArrays/StaticArrays.jl#920. Perhaps the version of StaticArrays used by Dojo (0.12.5) is not up-to-date?

NB: this only happens when Dojo is installed by add Dojo. The error does not appear when installing by add Dojo#main. (In both cases the version number is 0.1.0.)

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