|
| 1 | +## TrajectoryIndexingUtils methods |
| 2 | + |
| 3 | +This module contains helper functions for indexing and taking slices of the full problem variable vector |
| 4 | +definitions: |
| 5 | + |
| 6 | +* problem vector: |
| 7 | + Z = [z₁, z₂, ..., zₜ] |
| 8 | + |
| 9 | +* knot point: |
| 10 | + zₜ = [xₜ, uₜ] |
| 11 | + |
| 12 | +* augmented state vector: |
| 13 | + xₜ = [ψ̃ₜ, ψ̃²ₜ, ..., ψ̃ⁿₜ, ∫aₜ, aₜ, daₜ, ..., dᶜ⁻¹aₜ] |
| 14 | + |
| 15 | +where c = control_order |
| 16 | + |
| 17 | +also, below, we use `dim(zₜ) = dim` |
| 18 | +examples: |
| 19 | +```julia |
| 20 | +Z[index(t, pos, dim)] = zₜ[pos] |
| 21 | +Z[index(t, dim)] = zₜ[dim] |
| 22 | +Z[slice(t, pos1, pos2, dim)] = zₜ[pos1:pos2] |
| 23 | +Z[slice(t, pos, dim)] = zₜ[1:pos] |
| 24 | +Z[slice(t, dim)] = zₜ[1:dim] := zₜ |
| 25 | +Z[slice(t, dim; stretch=stretch)] = zₜ[1:(dim + stretch)] |
| 26 | +Z[slice(t, indices, dim)] = zₜ[indices] |
| 27 | +Z[slice(t1:t2, dim)] = [zₜ₁;...;zₜ₂] |
| 28 | +``` |
| 29 | + |
| 30 | +The functions are also used to access the zₜ vectors, e.g. |
| 31 | +```julia |
| 32 | +zₜ[slice(i, isodim)] = ψ̃ⁱₜ |
| 33 | +zₜ[n_wfn_states .+ slice(1, ncontrols)] = ∫aₜ |
| 34 | +zₜ[n_wfn_states .+ slice(2, ncontrols)] = aₜ |
| 35 | +zₜ[n_wfn_states .+ slice(augdim + 1, ncontrols)] = uₜ = ddaₜ |
| 36 | +``` |
| 37 | + |
| 38 | +Examples below are run with: |
| 39 | +```julia |
| 40 | +using TrajectoryIndexingUtils |
| 41 | +Z = collect(1.5:12.5) # Example vector as Float64 |
| 42 | +dim = 3 # Example dimension |
| 43 | +``` |
| 44 | + |
| 45 | +## API |
| 46 | + |
| 47 | +```@autodocs |
| 48 | +Modules = [TrajectoryIndexingUtils] |
| 49 | +``` |
0 commit comments