Skip to content

Commit b92577c

Browse files
committed
add update function in ManifoldProblem
correct tests
1 parent 10b7df0 commit b92577c

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ $$F:\mathbb R^{n} \to \mathbb R^m. $$
2626
This package requires Julia >= v1.3.0
2727

2828
To install it, please run
29-
30-
`] add MultiParamContinuation`
29+
30+
`] add https://github.com/bifurcationkit/MultiParamContinuation.jl`
3131

3232
To install the bleeding edge version, please run
3333

34-
`] add MultiParamContinuation#master`
34+
`] add https://github.com/bifurcationkit/MultiParamContinuation.jl#master`
3535

3636
## 📚 Support and citation
3737
If you use `BifurcationKit.jl` in your work, we ask that you cite the following paper on [HAL-Inria](https://hal.archives-ouvertes.fr/hal-02902346) with *bibtex* entry [CITATION.bib](https://github.com/bifurcationkit/BifurcationKit.jl/blob/master/CITATION.bib). Open source development as part of academic research strongly depends on this. Please also consider starring this repository if you like our work, this will help us to secure funding in the future.

src/problem.jl

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
abstract type AbstractManifoldProblem end
22

3+
update_default(args...; kwargs...) = true
4+
35
for op in (:ManifoldProblem, :ManifoldProblemBK)
46
@eval begin
57
"""
@@ -27,7 +29,7 @@ for op in (:ManifoldProblem, :ManifoldProblemBK)
2729
)
2830
```
2931
"""
30-
struct $op{Tu <: AbstractVector, Tp, TVF, Trec, Tproj, Ttangent, Tradius, Tevent, Tfinalize, Tbb, Tpc} <: AbstractManifoldProblem
32+
struct $op{Tu <: AbstractVector, Tp, TVF, Trec, Tproj, Ttangent, Tradius, Tevent, Tfinalize, Tbb, Tpc, Tupdate} <: AbstractManifoldProblem
3133
"[Internal] input space dimension"
3234
n::Int
3335
"[Internal] output space dimension"
@@ -54,14 +56,16 @@ for op in (:ManifoldProblem, :ManifoldProblemBK)
5456
project_for_tree::Tbb
5557
"[Internal] constrained problem for projecting on manifold"
5658
prob_cons::Tpc
57-
59+
"Function used to update the problem after each continuation step. The signature is `update_problem!(prob, ::Atlas)`"
60+
update!::Tupdate
5861
end
5962

6063
Base.size(prob::$op) = (prob.n, prob.m)
6164
@inline Base.eltype(prob::$op{Tu}) where Tu = eltype(Tu)
6265
@inline _has_projection(::$op{Tu, Tp, TVF, Trec, Tproj}) where {Tu, Tp, TVF, Trec, Tproj} = ~(Tproj == Nothing)
6366
@inline _has_tangent_computation(::$op{Tu, Tp, TVF, Trec, Tproj, Ttangent}) where {Tu, Tp, TVF, Trec, Tproj, Ttangent} = ~(Ttangent == Nothing)
6467
@inline _has_event(::$op{Tu, Tp, TVF, Trec, Tproj, Ttangent, Tradius, Tevent}) where {Tu, Tp, TVF, Trec, Tproj, Ttangent, Tradius, Tevent} = ~(Tevent == Nothing)
68+
@inline update_problem!(prob::$op, args...; kwargs...) = prob.update!(args...; kwargs...)
6569

6670
function $op(F, u0, par;
6771
m = length(F(u0, par)),
@@ -73,7 +77,8 @@ for op in (:ManifoldProblem, :ManifoldProblemBK)
7377
event_function = event_default,
7478
finalize_solution = finalize_default,
7579
project_for_tree = project_for_tree_default,
76-
prob_cons = nothing
80+
prob_cons = nothing,
81+
update! = update_default
7782
)
7883
n = length(u0)
7984
dim = n-m
@@ -92,7 +97,8 @@ for op in (:ManifoldProblem, :ManifoldProblemBK)
9297
event_function,
9398
finalize_solution,
9499
project_for_tree,
95-
prob_cons)
100+
prob_cons,
101+
update!)
96102
end
97103
end
98104
end

test/4d.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010

1111
prob = ManifoldProblem(F, [0.2,0.2,-0.,0], nothing;
1212
finalize_solution = ProductSpace([-5,-5,-1,-1],[5,5,1,1]),
13-
recordFromSolution = (u,p) -> [u[3],u[4],u[1]/2+u[2]/2]
13+
record_from_solution = (u,p;k...) -> [u[3],u[4],u[1]/2+u[2]/2]
1414
)
1515

1616
S = continuation(prob,

0 commit comments

Comments
 (0)