@@ -879,6 +879,7 @@ function DiffEqBase.DDEProblem{iip}(sys::AbstractODESystem, u0map = [],
879
879
check_length = true ,
880
880
eval_expression = false ,
881
881
eval_module = @__MODULE__ ,
882
+ u0_constructor = identity,
882
883
kwargs... ) where {iip}
883
884
if ! iscomplete (sys)
884
885
error (" A completed system is required. Call `complete` or `structural_simplify` on the system before creating a `DDEProblem`" )
@@ -892,6 +893,9 @@ function DiffEqBase.DDEProblem{iip}(sys::AbstractODESystem, u0map = [],
892
893
h (p, t) = h_oop (p, t)
893
894
h (p:: MTKParameters , t) = h_oop (p... , t)
894
895
u0 = h (p, tspan[1 ])
896
+ if u0 != = nothing
897
+ u0 = u0_constructor (u0)
898
+ end
895
899
896
900
cbs = process_events (sys; callback, eval_expression, eval_module, kwargs... )
897
901
kwargs = filter_kwargs (kwargs)
@@ -914,6 +918,7 @@ function DiffEqBase.SDDEProblem{iip}(sys::AbstractODESystem, u0map = [],
914
918
sparsenoise = nothing ,
915
919
eval_expression = false ,
916
920
eval_module = @__MODULE__ ,
921
+ u0_constructor = identity,
917
922
kwargs... ) where {iip}
918
923
if ! iscomplete (sys)
919
924
error (" A completed system is required. Call `complete` or `structural_simplify` on the system before creating a `SDDEProblem`" )
@@ -929,6 +934,9 @@ function DiffEqBase.SDDEProblem{iip}(sys::AbstractODESystem, u0map = [],
929
934
h (p:: MTKParameters , t) = h_oop (p... , t)
930
935
h (out, p:: MTKParameters , t) = h_iip (out, p... , t)
931
936
u0 = h (p, tspan[1 ])
937
+ if u0 != = nothing
938
+ u0 = u0_constructor (u0)
939
+ end
932
940
933
941
cbs = process_events (sys; callback, eval_expression, eval_module, kwargs... )
934
942
kwargs = filter_kwargs (kwargs)
0 commit comments