Skip to content

Commit

Permalink
Small bug in projected system initial check (#178)
Browse files Browse the repository at this point in the history
* Small bug in projected sys

* remove debug info

* Update Project.toml

---------

Co-authored-by: awage <>
Co-authored-by: George Datseris <datseris.george@gmail.com>
  • Loading branch information
awage and Datseris authored Jul 11, 2023
1 parent 458d123 commit 61ee01d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicalSystemsBase"
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
version = "3.2.0"
version = "3.2.1"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down
2 changes: 1 addition & 1 deletion src/derived_systems/projected_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function ProjectedDynamicalSystem(ds::DynamicalSystem, projection, complete_stat
remidxs = setdiff(1:dimension(ds), projection)
!isempty(remidxs) || error("Error with the indices of the projection")
else
length(complete_state(u0)) == dimension(ds) ||
length(complete_state(y)) == dimension(ds) ||
error("The returned vector of complete_state must equal dimension(ds)")
remidxs = nothing
end
Expand Down
5 changes: 3 additions & 2 deletions test/projected.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ p0_cont = [0.1, -0.4, -0.2]
proj_comp1 = (1:2, [1.0])
proj_comp2 = (1:2, (y) -> [y[1], y[2], y[2] + 1])
proj_comp3 = (u -> u/norm(u), y -> 10y)
proj_comp4 = (1:2, y -> [y..., 0])

function projected_tests(ds, pds, P)
@testset "projected dedicated" begin
Expand Down Expand Up @@ -43,13 +44,13 @@ function projected_tests(ds, pds, P)
end
end

@testset "IDT=$(IDT), IIP=$(IIP) proj=$(P)" for IDT in (true, false), IIP in (false, true), P in (1, 2, 3)
@testset "IDT=$(IDT), IIP=$(IIP) proj=$(P)" for IDT in (true, false), IIP in (false, true), P in (1, 2, 3, 4)
SystemType = IDT ? DeterministicIteratedMap : CoupledODEs
rule = !IIP ? trivial_rule : trivial_rule_iip
p0 = IDT ? p0_disc : p0_cont
ds = SystemType(rule, u0, p0)

projection, complete = (proj_comp1, proj_comp2, proj_comp3)[P]
projection, complete = (proj_comp1, proj_comp2, proj_comp3, proj_comp4)[P]
pds = ProjectedDynamicalSystem(ds, projection, complete)
u0init = recursivecopy(current_state(pds))

Expand Down

0 comments on commit 61ee01d

Please sign in to comment.