Skip to content

MethodError: no method matching copyto! #48

@Volker-Weissmann

Description

@Volker-Weissmann

Running this code

using SimpleDiffEq
f(u,p,t) = 2u
g(u,p,t) = 1
u0 = 0.5
tspan = (0.0,1.0)
prob = SDEProblem(f,g,u0,tspan)
sol = solve(prob,SimpleEM(),dt=0.25)
g(du,u,p,t) = du .= 2.0 * u
function f(du, u, p, t)
    g(du,u,p,t)
end

using SimpleDiffEq
f(u,p,t) = 2u
g(u,p,t) = 1
u0 = 0.5
tspan = (0.0,1.0)
prob = SDEProblem(f,g,u0,tspan)
sol = solve(prob,SimpleEM(),dt=0.25)
g(du,u,p,t) = du .= 2.0 * u
function f(du, u, p, t)
    g(du,u,p,t)
end

outputs:

ERROR: LoadError: MethodError: no method matching copyto!(::Float64, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Tuple{}, typeof(identity), Tuple{Float64}})
Closest candidates are:
  copyto!(::DiffEqArrayOperator, ::Any) at /home/volker/.julia/packages/SciMLBase/dyqr8/src/operators/basic_operators.jl:112
  copyto!(::Any, ::Base.Broadcast.Broadcasted{var"#s155", Axes, F, Args} where {var"#s155"<:StaticArrays.StaticArrayStyle, Axes, F, Args<:Tuple}) at /home/volker/.julia/packages/StaticArrays/xV8rq/src/broadcast.jl:29
  copyto!(::DiffEqBase.DiffEqBC, ::Base.Broadcast.Broadcasted{var"#s7", Axes, F, Args} where {var"#s7"<:Base.Broadcast.AbstractArrayStyle{0}, Axes, F, Args<:Tuple}) at /home/volker/.julia/packages/DiffEqBase/qntkj/src/diffeqfastbc.jl:42
  ...
Stacktrace:
 [1] materialize!
   @ ./broadcast.jl:894 [inlined]
 [2] materialize!
   @ ./broadcast.jl:891 [inlined]
 [3] g(du::Float64, u::Float64, p::SciMLBase.NullParameters, t::Float64)
   @ Main ~/Sync/DatenVolker/git/sm_with_julia/bug.jl:8
 [4] f(du::Float64, u::Float64, p::SciMLBase.NullParameters, t::Float64)
   @ Main ~/Sync/DatenVolker/git/sm_with_julia/bug.jl:10
 [5] (::SDEFunction{true, typeof(f), typeof(g), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing})(::Float64, ::Vararg{Any, N} where N)
   @ SciMLBase ~/.julia/packages/SciMLBase/dyqr8/src/scimlfunctions.jl:395
 [6] solve(::SDEProblem{Float64, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, Nothing, SDEFunction{true, typeof(f), typeof(g), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, typeof(g), Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Nothing}, ::SimpleEM; dt::Float64)
   @ SimpleDiffEq ~/.julia/packages/SimpleDiffEq/vIpeG/src/euler_maruyama.jl:57
 [7] top-level scope
   @ ~/Sync/DatenVolker/git/sm_with_julia/bug.jl:19
in expression starting at /home/volker/Sync/DatenVolker/git/sm_with_julia/bug.jl:19

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