Skip to content

Add PseudoHamiltonianVectorField data type #506

Description

@ocots

Context

Flow(h̃, law) builds a Hamiltonian flow from a scalar pseudo-Hamiltonian H̃(t,x,p,u,v) differentiated by AD. There is no equivalent for a user who has already hand-differentiated the pseudo-Hamiltonian dynamics — i.e. who has ẋ = ∂H̃/∂p, ṗ = -∂H̃/∂x as explicit functions (dx,dp)(t,x,p,u,v) — exactly the gap that HamiltonianVectorField fills relative to Hamiltonian on the no-control side.

This completes the missing corner of the grid:

scalar (AD) vector field (no AD)
no control HamiltonianFlow(h) HamiltonianVectorFieldFlow(hvf)
control + law PseudoHamiltonianFlow(h̃, law) PseudoHamiltonianVectorFieldFlow(h̃vf, law)

Scope (this repo)

  • New Data.AbstractPseudoHamiltonianVectorField{TD,VD,MD} <: Data.AbstractVectorField{TD,VD,MD} — a sibling of AbstractHamiltonianVectorField, not a subtype (mirrors how AbstractPseudoHamiltonian is a sibling of, not a subtype of, AbstractHamiltonian).
  • New Data.PseudoHamiltonianVectorField{F,TD,VD,MD} wrapping f::F returning (dx,dp) (or (dx,dp,dpv) when variable_costate=true), with an explicit control argument u threaded through every natural/uniform call signature — modeled on HamiltonianVectorField.
  • Both in-place and out-of-place support, and variable-costate (dpv) support from the start (confirmed scope).
  • No AD conversion helper (e.g. pseudo_hamiltonian_vector_field(h̃; ...)) — out of scope for now.

Companion issue

The system + Flow(h̃vf, law) constructor land in CTFlows.jl — see the companion issue there.

Status

  • Branch feat/pseudo-hamiltonian-vector-field (worktree at .worktrees/CTBase-pseudo-hvf)
  • AbstractPseudoHamiltonianVectorField + PseudoHamiltonianVectorField (src/Data)
  • Signature helpers (_natural_sig_phvf/_uniform_sig_phvf)
  • Module wiring (includes/exports)
  • Unit tests (887/887 passing, including 17 abstract-type tests + 92 concrete-type tests)
  • Docstrings (deferred to last, per repo convention)
  • docs/api_reference.jl wiring

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions