From 86126d9267e434f59dbe24e49a382c3d3e2d8ac0 Mon Sep 17 00:00:00 2001 From: romain veltz Date: Sun, 5 Jan 2025 10:27:33 +0100 Subject: [PATCH] build_jacobian -> generate_jacobian --- src/periodicorbit/PeriodicOrbitCollocation.jl | 5 +++-- src/periodicorbit/codim2/codim2.jl | 6 +++--- test/lorenz84.jl | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/periodicorbit/PeriodicOrbitCollocation.jl b/src/periodicorbit/PeriodicOrbitCollocation.jl index 287a0558..b02f6f90 100644 --- a/src/periodicorbit/PeriodicOrbitCollocation.jl +++ b/src/periodicorbit/PeriodicOrbitCollocation.jl @@ -620,6 +620,7 @@ Compute the jacobian of the problem defining the periodic orbits by orthogonal c mul!(pj, uc[:, rg], L) # pj ≈ (L * uj')' # put the jacobian of the vector field for l in 1:m + _rgX = rgNx .+ (l-1)*n if _transpose == false J0 .= jacobian(VF, pj[:,l], pars) else @@ -986,7 +987,7 @@ function newton(probPO::PeriodicOrbitOCollProblem, _newton_pocoll(probPO, orbitguess, options; defOp = defOp, kwargs...) end -function build_jacobian(coll::PeriodicOrbitOCollProblem, +function generate_jacobian(coll::PeriodicOrbitOCollProblem, orbitguess, par; δ = convert(eltype(orbitguess), 1e-8)) @@ -1038,7 +1039,7 @@ function continuation(coll::PeriodicOrbitOCollProblem, plot_solution = nothing, kwargs...) - jacPO = build_jacobian(coll, orbitguess, getparams(coll); δ) + jacPO = generate_jacobian(coll, orbitguess, getparams(coll); δ) _Jcoll = analytical_jacobian(coll, orbitguess, getparams(coll)) if linear_algo isa COPBLS linear_algo = COPBLS(coll) diff --git a/src/periodicorbit/codim2/codim2.jl b/src/periodicorbit/codim2/codim2.jl index 17596c1c..6e9fd252 100644 --- a/src/periodicorbit/codim2/codim2.jl +++ b/src/periodicorbit/codim2/codim2.jl @@ -276,7 +276,7 @@ function _continuation(gh::Bautin, br::AbstractResult{Tkind, Tprob}, _recordsol = modify_po_record(probPO, kwargs, getparams(probPO), getlens(probPO)) _plotsol = modify_po_plot(probPO, kwargs) - jac = build_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) + jac = generate_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) pbwrap = _wrap(probPO, jac, orbitguess, getparams(probPO), getlens(probPO), _plotsol, _recordsol) # we have to change the Bordered linearsolver to cope with our type FloquetWrapper @@ -394,7 +394,7 @@ function _continuation(hh::HopfHopf, br::AbstractResult{Tkind, Tprob}, _recordsol = modify_po_record(probPO, _kwargs, getparams(probPO), getlens(probPO)) _plotsol = modify_po_plot(probPO, _kwargs) - jac = build_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) + jac = generate_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) pbwrap = _wrap(probPO, jac, orbitguess, getparams(probPO), getlens(probPO), _plotsol, _recordsol) # we have to change the Bordered linearsolver to cope with our type FloquetWrapper @@ -524,7 +524,7 @@ function _continuation(zh::ZeroHopf, br::AbstractResult{Tkind, Tprob}, _recordsol = modify_po_record(probPO, kwargs, getparams(probPO), getlens(probPO)) _plotsol = modify_po_plot(probPO, kwargs) - jac = build_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) + jac = generate_jacobian(probPO, orbitguess, getparams(probPO); δ = getdelta(prob_vf)) pbwrap = _wrap(probPO, jac, orbitguess, getparams(probPO), getlens(probPO), _plotsol, _recordsol) # we have to change the Bordered linearsolver to cope with our type FloquetWrapper diff --git a/test/lorenz84.jl b/test/lorenz84.jl index 95d5d3e1..b4987bff 100644 --- a/test/lorenz84.jl +++ b/test/lorenz84.jl @@ -221,7 +221,7 @@ for _jac in (:autodiff, :minaug, :finiteDifferences, :MinAugMatrixBased) @test bpbt_2.nfsupp.H0002 ≈ [-0.34426541029040103, 0.7403628764888541, 0.5020796040084594, 0.7211107457956355] rtol = 1e-3 rtol = 1e-3 @test bpbt_2.nfsupp.H1001 ≈ [0.8609019479520158, 0.3666091456682787, 0.09272126477464948, -1.1252591151814477] rtol = 1e-3 @test bpbt_2.nfsupp.H2000 ≈ [-1.1430891994241816, 0.5090981254844374, 0.4300904962638521, -0.4240003230561569] rtol = 1e-3 - # test branch switching from BT points + # test branch switching from BT points hp_codim2_2 = continuation(sn_codim2, 1, ContinuationPar(opts_br, ds = -0.001, dsmax = 0.02, dsmin = 1e-4, n_inversion = 6, detect_bifurcation = 1, p_max = 15.) ; normC = norminf, detect_codim2_bifurcation = 2,