Skip to content

Commit d30732b

Browse files
committed
Fixed GeometricBase version to 0.11, GeometricSolutions to 0.5 and GeometricEquations to 0.19. I also replaced tstep with timestep.
Got rid of GeometricIntegrators again.
1 parent b977b27 commit d30732b

31 files changed

+131
-131
lines changed

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GeometricMachineLearning"
22
uuid = "194d25b2-d3f5-49f0-af24-c124f4aa80cc"
3-
authors = ["Michael Kraus <[email protected]>"]
43
version = "0.4.4"
4+
authors = ["Michael Kraus <[email protected]>"]
55

66
[deps]
77
AbstractNeuralNetworks = "60874f82-5ada-4c70-bd1c-fa6be7711c8a"
@@ -13,6 +13,7 @@ Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
1313
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1414
GeometricBase = "9a0b12b7-583b-4f04-aa1f-d8551b6addc9"
1515
GeometricEquations = "c85262ba-a08a-430a-b926-d29770767bf2"
16+
GeometricIntegrators = "dcce2d33-59f6-5b8d-9047-0defad88ae06"
1617
GeometricSolutions = "7843afe4-64f4-4df4-9231-049495c56661"
1718
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
1819
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
@@ -41,10 +42,9 @@ ChainRulesCore = "1"
4142
ChainRulesTestUtils = "1"
4243
Distances = "0.10"
4344
ForwardDiff = "0.10, 1"
44-
GeometricBase = "0.10"
45-
GeometricEquations = "0.18, 0.19"
46-
GeometricIntegrators = "0.14.2"
47-
GeometricSolutions = "0.3.24, 0.4"
45+
GeometricBase = "0.11"
46+
GeometricEquations = "0.19"
47+
GeometricSolutions = "0.5"
4848
HDF5 = "0.16, 0.17"
4949
KernelAbstractions = "0.9"
5050
LazyArrays = "=2.3.2"

docs/src/optimizers/manifold_related/parallel_transport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ Y_increments = []
134134
Δ₂_transported = []
135135
136136
const n_steps = 6
137-
const tstep = 2
137+
const timestep = 2
138138
139139
for _ in 1:n_steps
140-
update_section!(λY, tstep * B, geodesic)
140+
update_section!(λY, timestep * B, geodesic)
141141
push!(Y_increments, copy(λY.Y))
142142
push!(Δ_transported, Matrix(λY) * B * E)
143143
push!(Δ₂_transported, Matrix(λY) * B₂ * E)

docs/src/tutorials/linear_symplectic_transformer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ CairoMakie.activate!() # hide
3131
import Random # hide
3232
Random.seed!(123) # hide
3333
34-
const tstep = .3
34+
const timestep = .3
3535
const n_init_con = 5
3636
3737
# ensemble problem
38-
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; tstep = tstep)
38+
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; timestep = timestep)
3939
dl = DataLoader(integrate(ep, ImplicitMidpoint()); suppress_info = true)
4040
# dl = DataLoader(vcat(dl_nt.input.q, dl_nt.input.p)) # hide
4141

docs/src/tutorials/matrix_softmax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ mpurple = RGBf(148 / 256, 103 / 256, 189 / 256) # hide
4747
mblue = RGBf(31 / 256, 119 / 256, 180 / 256) # hide
4848
mgreen = RGBf(44 / 256, 160 / 256, 44 / 256) # hide
4949
50-
const tstep = .3
50+
const timestep = .3
5151
const n_init_con = 5
5252
5353
# ensemble problem
54-
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; tstep = tstep)
54+
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; timestep = timestep)
5555
dl = DataLoader(integrate(ep, ImplicitMidpoint()); suppress_info = true)
5656
# dl = DataLoader(vcat(dl_nt.input.q, dl_nt.input.p)) # hide
5757

docs/src/tutorials/softmax_comparison.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ CairoMakie.activate!() # hide
4040
import Random # hide
4141
Random.seed!(123) # hide
4242
43-
const tstep = .3
43+
const timestep = .3
4444
const n_init_con = 5
4545
4646
# ensemble problem
47-
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; tstep = tstep)
47+
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; timestep = timestep)
4848
dl = DataLoader(integrate(ep, ImplicitMidpoint()); suppress_info = true)
4949
5050
nothing # hide

docs/src/tutorials/symplectic_transformer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ CairoMakie.activate!() # hide
3131
import Random # hide
3232
Random.seed!(123) # hide
3333
34-
const tstep = .3
34+
const timestep = .3
3535
const n_init_con = 5
3636
3737
# ensemble problem
38-
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; tstep = tstep)
38+
ep = hodeensemble([rand(2) for _ in 1:n_init_con], [rand(2) for _ in 1:n_init_con]; timestep = timestep)
3939
dl = DataLoader(integrate(ep, ImplicitMidpoint()); suppress_info = true)
4040
# dl = DataLoader(vcat(dl_nt.input.q, dl_nt.input.p)) # hide
4141

docs/src/tutorials/volume_preserving_transformer_rigid_body.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ nothing # hide
2626
We now generate the data by integrating with:
2727

2828
```@example rigid_body
29-
const tstep = .2
29+
const timestep = .2
3030
const tspan = (0., 20.)
3131
nothing # hide
3232
```
@@ -38,7 +38,7 @@ using GeometricMachineLearning # hide
3838
using GeometricIntegrators: integrate, ImplicitMidpoint
3939
using GeometricProblems.RigidBody: odeproblem, odeensemble, default_parameters
4040
41-
ensemble_problem = odeensemble(ics; tspan = tspan, tstep = tstep, parameters = default_parameters)
41+
ensemble_problem = odeensemble(ics; tspan = tspan, timestep = timestep, parameters = default_parameters)
4242
ensemble_solution = integrate(ensemble_problem, ImplicitMidpoint())
4343
4444
dl_cpu = DataLoader(ensemble_solution; suppress_info = true)
@@ -229,16 +229,16 @@ const t_validation = 120
229229
230230
function produce_trajectory(ics_val)
231231
problem = odeproblem(ics_val; tspan = (0, t_validation),
232-
tstep = tstep,
232+
timestep = timestep,
233233
parameters = default_parameters)
234234
solution = integrate(problem, ImplicitMidpoint())
235235
trajectory = Float32.(DataLoader(solution; suppress_info = true).input)
236236
nn_vpff_solution = iterate(nn_vpff, trajectory[:, 1];
237-
n_points = Int(floor(t_validation / tstep)) + 1)
237+
n_points = Int(floor(t_validation / timestep)) + 1)
238238
nn_vpt_solution = iterate(nn_vpt, trajectory[:, 1:seq_length];
239-
n_points = Int(floor(t_validation / tstep)) + 1)
239+
n_points = Int(floor(t_validation / timestep)) + 1)
240240
nn_st_solution = iterate(nn_st, trajectory[:, 1:seq_length];
241-
n_points = Int(floor(t_validation / tstep)) + 1)
241+
n_points = Int(floor(t_validation / timestep)) + 1)
242242
trajectory, nn_vpff_solution, nn_vpt_solution, nn_st_solution
243243
end
244244
@@ -314,14 +314,14 @@ We can see that the volume-preserving transformer performs much better than the
314314
We also compare the times it takes to integrate the system with (i) implicit midpoint, (ii) the volume-preserving transformer and (iii) the standard transformer:
315315
```@example rigid_body
316316
function timing() # hide
317-
problem = odeproblem(ics_val₁; tspan = (0, t_validation), tstep = tstep, parameters = default_parameters) # hide
317+
problem = odeproblem(ics_val₁; tspan = (0, t_validation), timestep = timestep, parameters = default_parameters) # hide
318318
solution = integrate(problem, ImplicitMidpoint()) # hide
319319
@time "Implicit Midpoint" solution = integrate(problem, ImplicitMidpoint())
320320
trajectory = Float32.(DataLoader(solution; suppress_info = true).input)
321-
iterate(nn_vpt, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / tstep)) + 1) # hide
322-
@time "VPT" iterate(nn_vpt, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / tstep)) + 1)
323-
iterate(nn_st, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / tstep)) + 1) # hide
324-
@time "ST" iterate(nn_st, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / tstep)) + 1)
321+
iterate(nn_vpt, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / timestep)) + 1) # hide
322+
@time "VPT" iterate(nn_vpt, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / timestep)) + 1)
323+
iterate(nn_st, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / timestep)) + 1) # hide
324+
@time "ST" iterate(nn_st, trajectory[:, 1:seq_length]; n_points = Int(floor(t_validation / timestep)) + 1)
325325
nothing # hide
326326
end # hide
327327
timing() # hide

scripts/Script_using_fully_GML/data_problem.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,32 +85,32 @@ end
8585
########################################################################################
8686
# get data of a problem for Sypmnet (results is (data = target =(q,p))) from Hamiltonian
8787

88-
function get_phase_space_data(nameproblem, q₀, p₀, tspan = (0., 100.), tstep = 0.1)
88+
function get_phase_space_data(nameproblem, q₀, p₀, tspan = (0., 100.), timestep = 0.1)
8989

9090
# get the Hamiltonien corresponding to name_problem
9191
H_problem, n_dim = dict_problem_H[nameproblem]
9292

93-
q,p = compute_phase_space(H_problem, q₀, p₀, tspan, tstep)
93+
q,p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
9494

9595
return (q, p)
9696
end
9797

9898

99-
function get_phase_space_multiple_trajectoy(nameproblem; singlematrix = true, n_trajectory = 1, n_points = 10, tstep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
99+
function get_phase_space_multiple_trajectoy(nameproblem; singlematrix = true, n_trajectory = 1, n_points = 10, timestep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
100100

101101
# get the Hamiltonien corresponding to name_problem
102102
H_problem, n_dim = dict_problem_H[nameproblem]
103103

104104
#define timespan
105-
tspan=(0.,n_points*tstep)
105+
tspan=(0.,n_points*timestep)
106106

107107
#compute phase space for each trajectory staring from a random point
108108
trajectory_q = [zeros(n_points+1,n_dim) for _ in 1:n_trajectory]
109109
trajectory_p = [zeros(n_points+1,n_dim) for _ in 1:n_trajectory]
110110
for i in 1:n_trajectory
111111
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
112112
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
113-
trajectory_q[i],trajectory_p[i] = compute_phase_space(H_problem, q₀, p₀, tspan, tstep)
113+
trajectory_q[i],trajectory_p[i] = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
114114
end
115115

116116
if singlematrix
@@ -125,7 +125,7 @@ end
125125
###############################################################################
126126
# compute phase space from the Hamiltonian
127127

128-
function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), tstep = 0.1)
128+
function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), timestep = 0.1)
129129

130130
n_dim = length(q₀)
131131

@@ -144,7 +144,7 @@ function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), tstep =
144144
h(t, q, p, params) = H2(q,p)
145145

146146
# simulate data with geometric Integrators
147-
ode = HODEProblem(v, f, h, tspan, tstep, q₀, p₀)
147+
ode = HODEProblem(v, f, h, tspan, timestep, q₀, p₀)
148148

149149
#return sol = integrate(ode, SymplecticEulerA())
150150
return sol = integrate(ode, SymplecticTableau(TableauExplicitEuler()))
@@ -168,14 +168,14 @@ struct storing_data{T}
168168
end
169169

170170

171-
function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_points = 10, tstep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
171+
function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_points = 10, timestep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
172172

173173

174174
# get the Hamiltonien corresponding to name_problem
175175
H_problem, n_dim = dict_problem_H[nameproblem]
176176

177177
#define timespan
178-
tspan=(0.,n_points*tstep)
178+
tspan=(0.,n_points*timestep)
179179

180180
#compute phase space for each trajectory staring from a random point
181181
pre_data = NamedTuple()
@@ -184,7 +184,7 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
184184

185185
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
186186
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
187-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, tstep)
187+
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
188188

189189
Data = [(q[n], p[n]) for n in 1:size(q,1)]
190190

@@ -194,14 +194,14 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
194194
pre_data = merge(pre_data,nt)
195195
end
196196

197-
data = storing_data(tstep, n_trajectory, pre_data)
197+
data = storing_data(timestep, n_trajectory, pre_data)
198198

199199

200200

201201
return data #data_trajectory(data, Get_nb_trajectory, Get_length_trajectory, Get_q, Get_p, Get_Δt)
202202
end
203203

204-
function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory = 1, n_points = 10, tstep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
204+
function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory = 1, n_points = 10, timestep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
205205

206206

207207
# get the Hamiltonien corresponding to name_problem
@@ -217,7 +217,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
217217
dH(x) = symplectic_matrix * ∇H(x)
218218

219219
#define timespan
220-
tspan=(0.,n_points*tstep)
220+
tspan=(0.,n_points*timestep)
221221

222222
#compute phase space for each trajectory staring from a random point
223223
pre_data = NamedTuple()
@@ -227,7 +227,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
227227

228228
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
229229
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
230-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, tstep)
230+
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
231231

232232
Data = [(q[n], p[n]) for n in 1:size(q,1)]
233233
data_calc = [[q[n]..., p[n]...] for n in 1:size(q,1)]
@@ -243,7 +243,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
243243

244244
end
245245

246-
data = storing_data(tstep, n_trajectory, pre_data)
246+
data = storing_data(timestep, n_trajectory, pre_data)
247247

248248
Get_Δt(Data) = Data.Δt
249249
Get_nb_trajectory(Data) = Data.nb_trajectory
@@ -258,18 +258,18 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
258258
end
259259

260260

261-
function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory = 1, n_points = 10, tstep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
261+
function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory = 1, n_points = 10, timestep = 0.1, qmin = -0.2, pmin = -0.2, qmax = 0.2, pmax = 0.2)
262262

263263

264264
# get the Hamiltonien corresponding to name_problem
265265
H_problem, n_dim = dict_problem_L[nameproblem]
266266

267267
#define timespan
268-
tspan=(0.,n_points*tstep)
268+
tspan=(0.,n_points*timestep)
269269

270270
#compute phase space for each trajectory staring from a random point
271271
pre_data = []
272-
push!(pre_data,[tstep])
272+
push!(pre_data,[timestep])
273273
push!(pre_data,[n_trajectory])
274274
push!(pre_data, [n_points+1])
275275

@@ -278,7 +278,7 @@ function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory
278278

279279
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
280280
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
281-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, tstep)
281+
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
282282

283283
Data = [q[n] for n in 1:size(q,1)]
284284

scripts/Script_using_fully_GML/lnn_script.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535

3636

3737
#=
38-
Data = get_multiple_trajectory_structure(:pendulum; n_trajectory = 20, n_points = 1000, tstep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
38+
Data = get_multiple_trajectory_structure(:pendulum; n_trajectory = 20, n_points = 1000, timestep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
3939
4040
Get_Data = Dict(
4141
:Δt => Data -> Data.Δt,

scripts/Script_using_fully_GML/sympnet_script.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ nameproblem = :pendulum
88

99
H , n_dim = dict_problem_H[nameproblem]
1010

11-
Data = get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_points = 1000, tstep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
11+
Data = get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_points = 1000, timestep = 0.1, qmin = -1.2, pmin = -1.2, qmax = 1.2, pmax = 1.2)
1212

1313
get_Data = Dict(
1414
:Δt => Data -> Data.Δt,

0 commit comments

Comments
 (0)