Skip to content

Commit b4e9f4b

Browse files
Merge pull request #1091 from ErikQQY/qqy/bvp_guess_u0
Allow u0 in BVProblem as Vector initial guess
2 parents b28acb7 + 679ed0c commit b4e9f4b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/fastpow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const EXP2FT = (Float32(0x1.6a09e667f3bcdp-1),
5656
fastpow(x::T, y::T) where {T} -> float(T)
5757
Trips through Float32 for performance.
5858
"""
59-
@inline function fastpow(x::T, y::T) where {T<:Real}
59+
@inline function fastpow(x::T, y::T) where {T <: Real}
6060
outT = float(T)
6161
if iszero(x)
6262
return zero(outT)

src/solve.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ function build_null_solution(prob::AbstractDEProblem, args...;
678678
end
679679

680680
timeseries = [Float64[] for i in 1:length(ts)]
681-
681+
682682
if SciMLBase.has_initializeprob(prob.f) && SciMLBase.has_initializeprobpmap(prob.f)
683683
initializeprob = prob.f.initializeprob
684684
nlsol = solve(initializeprob)
@@ -1427,6 +1427,7 @@ function check_prob_alg_pairing(prob, alg)
14271427
prob isa SDDEProblem && !(alg isa AbstractSDEAlgorithm) ||
14281428
prob isa DDEProblem && !(alg isa AbstractDDEAlgorithm) ||
14291429
prob isa DAEProblem && !(alg isa AbstractDAEAlgorithm) ||
1430+
prob isa BVProblem && !(alg isa AbstractBVPAlgorithm) ||
14301431
prob isa SteadyStateProblem && !(alg isa AbstractSteadyStateAlgorithm)
14311432
throw(ProblemSolverPairingError(prob, alg))
14321433
end
@@ -1460,8 +1461,10 @@ function check_prob_alg_pairing(prob, alg)
14601461
if !SciMLBase.allows_arbitrary_number_types(alg)
14611462
if isdefined(prob, :u0)
14621463
uType = RecursiveArrayTools.recursive_unitless_eltype(prob.u0)
1464+
u0_as_initial_guess = (prob isa BVProblem) && (uType <: Vector)
14631465
if Base.isconcretetype(uType) &&
1464-
!(uType <: Union{Float32, Float64, ComplexF32, ComplexF64})
1466+
!(uType <: Union{Float32, Float64, ComplexF32, ComplexF64}) &&
1467+
!u0_as_initial_guess
14651468
throw(GenericNumberTypeError(alg,
14661469
isdefined(prob, :u0) ? typeof(prob.u0) :
14671470
nothing,

src/termination_conditions.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ tolerances.
3535
"""
3636
struct SimpleNonlinearSolveTerminationMode <: AbstractNonlinearTerminationMode
3737
function SimpleNonlinearSolveTerminationMode()
38-
Base.depwarn("`SimpleNonlinearSolveTerminationMode` is deprecated and isn't used \
39-
in any upstream library. Remove uses of this.",
38+
Base.depwarn(
39+
"`SimpleNonlinearSolveTerminationMode` is deprecated and isn't used \
40+
in any upstream library. Remove uses of this.",
4041
:SimpleNonlinearSolveTerminationMode)
4142
return new()
4243
end

0 commit comments

Comments
 (0)