Private API
This page lists non-exported (internal) symbols of CTLie.
From CTLie
Ad [Struct]
CTLie.Ad Type
struct Ad{TX, TF, B<:CTBase.Differentiation.AbstractADBackend, TD, VD} <: FunctionCallable struct representing the Lie derivative or Lie bracket of foo along X.
Scalar
foo: Lie derivative∇foo(x)'·X(x)— first JVP, no second pass.Vector
foo: Lie bracketJ_foo(x)·X(x) - J_X(x)·foo(x)— two JVPs viaDifferentiation.pushforward, eliminating the per-call inner closures (X̂ = x_->X(x_),f̂ = x_->foo(x_),g(s) = f̂(x+s·X_x)) that the old closure-based_adcreated on every evaluation.
TD and VD are compile-time trait parameters so the correct call method (and slot numbering) is resolved statically.
DG_AD_BACKEND [Constant]
CTLie.DG_AD_BACKEND Constant
Global reference to the automatic differentiation backend used by CTLie operations.
This Ref holds the current AD backend that is used by CTLie.ad, CTLie.Poisson, and CTLie.∂ₜ when no explicit ad_backend keyword argument is provided.
Type
Ref{Differentiation.AbstractADBackend}: Mutable reference to an AD backend.
Notes
Initialized at module load time with
AutoForwardDiffviaCTBase.Differentiation.build_ad_backend.Modified via
CTLie.dg_ad_backend!.Accessed via
CTLie.dg_ad_backend.
See also: CTLie.dg_ad_backend, CTLie.dg_ad_backend!, CTLie.__dg_ad_backend.
PoissonBracket [Struct]
CTLie.PoissonBracket Type
struct PoissonBracket{FH, FG, B<:CTBase.Differentiation.AbstractADBackend, TD, VD} <: FunctionCallable struct representing the Poisson bracket {H, G} = ∇ₚH'∇ₓG - ∇ₓH'∇ₚG.
Replaces the four closures previously returned by _Poisson. TD and VD are compile-time trait parameters so the correct call method is resolved statically. Partial derivatives are computed via Differentiation.differentiate.
TimeDeriv_F [Struct]
CTLie.TimeDeriv_F Type
struct TimeDeriv_F{F, B<:CTBase.Differentiation.AbstractADBackend} <: FunctionCallable struct for ∂ₜ(f::Function) — time derivative of a generic callable.
Replaces the outer closure (t, args...) -> Differentiation.derivative(b, s -> f(s, args...), t).
TimeDeriv_Ham [Struct]
CTLie.TimeDeriv_Ham Type
struct TimeDeriv_Ham{FH, B<:CTBase.Differentiation.AbstractADBackend, TD, VD} <: FunctionCallable struct for ∂ₜ(H::AbstractHamiltonian).
Autonomous:
∂H/∂t = 0; returnszero(H(...))without AD.NonAutonomous: differentiates
Hw.r.t. slot 1 (time) viaDifferentiation.differentiate.
TimeDeriv_VF [Struct]
CTLie.TimeDeriv_VF Type
struct TimeDeriv_VF{FX, B<:CTBase.Differentiation.AbstractADBackend, TD, VD} <: FunctionCallable struct for ∂ₜ(X::AbstractVectorField).
Autonomous:
∂X/∂t = 0; returnszero.(X(...))without AD.NonAutonomous: differentiates
Xw.r.t. slot 1 (time) viaDifferentiation.differentiate.
_Bracketable [Struct]
CTLie._Bracketable Type
Type alias for operands that support Lie bracket computation.
Unifies Function and AbstractVectorField for dispatch in the @Lie macro and related operations. This enables consistent handling of both raw functions and wrapped vector fields in Lie bracket computations.
Notes
Used internally by
CTLie._lie_macfor runtime dispatch.Functions are normalized to
VectorFieldbefore actual computation.
See also: CTLie.@Lie, CTLie.ad, CTBase.Data.AbstractVectorField.
_Poissonable [Struct]
CTLie._Poissonable Type
Type alias for operands that support Poisson bracket computation.
Unifies Function and AbstractHamiltonian for dispatch in the @Lie macro and related operations. This enables consistent handling of both raw functions and wrapped Hamiltonians in Poisson bracket computations.
Notes
Used internally by
CTLie._poisson_macfor runtime dispatch.Functions are normalized to
Hamiltonianbefore actual computation.
See also: CTLie.@Lie, CTLie.Poisson, CTBase.Data.AbstractHamiltonian.
__dg_ad_backend [Function]
CTLie.__dg_ad_backend Function
__dg_ad_backend() -> CTBase.Core.NotProvidedTypeReturn the sentinel value indicating no AD backend was explicitly provided.
This function is used as the default value for the ad_backend keyword argument in CTLie operations. When returned, the global backend DG_AD_BACKEND is used instead.
Returns
CTBase.Core.NotProvided(singletonCTBase.Core.NotProvidedType): sentinel indicating backend should use global default.
Notes
This is an internal function used by
CTLie._resolve_backend.Users should use
CTLie.dg_ad_backendto get the current backend.
See also: CTLie.DG_AD_BACKEND, CTLie._resolve_backend.
__parse_lie_opts [Function]
CTLie.__parse_lie_opts Function
Parse keyword arguments for the @Lie macro.
Arguments
args...: Keyword arguments to parse.
Returns
NamedTuple: Parsed options (TD, VD, has_aut, has_var, backend).Expr: Error expression if parsing failed, otherwisenothing.
__transform_brackets [Function]
CTLie.__transform_brackets Function
Transform bracket expressions into macro dispatch calls.
Replaces [a, b] with calls to _lie_mac and {a, b} with calls to _poisson_mac.
Arguments
expr: Expression to transform.opts: NamedTuple with TD, VD, has_aut, has_var, backend.
Returns
Expr: Transformed expression.
_as_ham [Function]
CTLie._as_ham Function
Normalize a function to a Hamiltonian or pass through existing Hamiltonian.
Arguments
f::Function: Function to wrap as Hamiltonian.::Type{TD}: Time dependence type.::Type{VD}: Variable dependence type.
Returns
Data.Hamiltonian: Wrapped function or original Hamiltonian.
_as_vf [Function]
CTLie._as_vf Function
Normalize a function to a VectorField or pass through existing VectorField.
Arguments
f::Function: Function to wrap as VectorField.::Type{TD}: Time dependence type.::Type{VD}: Variable dependence type.
Returns
Data.VectorField: Wrapped function or original VectorField.
_check_not_hvf [Function]
CTLie._check_not_hvf Function
Check that vector field is not a HamiltonianVectorField (runtime check).
Arguments
::Data.AbstractVectorField: Plain vector field (allowed).
Returns
nothing
Throw NotImplemented if vector field is a HamiltonianVectorField.
HamiltonianVectorFields have signature (x, p) not (x), so they cannot be used with the Lie bracket operations on plain vector fields.
Arguments
X::Data.AbstractHamiltonianVectorField: Hamiltonian vector field (not allowed).
Throws
Exceptions.NotImplemented: Always thrown for HamiltonianVectorFields.
_check_outofplace [Function]
CTLie._check_outofplace Function
Check that mutability type is OutOfPlace (static dispatch on type parameter).
Arguments
::Type{Traits.OutOfPlace}: OutOfPlace mutability type.
Returns
nothing
Throw NotImplemented if mutability type is not OutOfPlace.
Arguments
::Type{MD}: Mutability type (must be OutOfPlace).
Throws
Exceptions.NotImplemented: If mutability is not OutOfPlace.
_check_td [Function]
CTLie._check_td Function
Check time dependence consistency (no-op when not checking).
Arguments
_: Operand (unused).::Type: Target time dependence type (unused).::Val{false}: Not checking.
Returns
nothing
Check time dependence consistency when is_autonomous is specified.
Arguments
x: Operand to check.::Type{TDu}: Target time dependence type.::Val{true}: Checking is enabled.
Returns
nothingif traits match.
Throws
Exceptions.PreconditionError: If traits conflict.
_check_vd [Function]
CTLie._check_vd Function
Check variable dependence consistency (no-op when not checking).
Arguments
_: Operand (unused).::Type: Target variable dependence type (unused).::Val{false}: Not checking.
Returns
nothing
Check variable dependence consistency when is_variable is specified.
Arguments
x: Operand to check.::Type{VDu}: Target variable dependence type.::Val{true}: Checking is enabled.
Returns
nothingif traits match.
Throws
Exceptions.PreconditionError: If traits conflict.
_lie_mac [Function]
CTLie._lie_mac Function
Runtime dispatch for Lie bracket macro expansion — typed method.
Normalizes operands, checks trait consistency, and calls CTLie.ad.
Arguments
a::_Bracketable: First operand (Function or AbstractVectorField).b::_Bracketable: Second operand (Function or AbstractVectorField).::Type{TD}: Time dependence type.::Type{VD}: Variable dependence type.has_aut::Val: Whether to check time dependence.has_var::Val: Whether to check variable dependence.backend: AD backend expression.
Returns
- Result of
CTLie.adcall.
Runtime dispatch for Lie bracket macro expansion — error for two Hamiltonian operands.
Disambiguator overload for the case when both operands are AbstractHamiltonian, which would otherwise be ambiguous between the two one-sided error overloads.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Poisson bracket.
Runtime dispatch for Lie bracket macro expansion — error for Hamiltonian as first operand.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Poisson bracket.
Runtime dispatch for Lie bracket macro expansion — error for Hamiltonian as second operand.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Poisson bracket.
Runtime dispatch for Lie bracket macro expansion — fallback for data literals.
When [a, b] contains numeric literals or other non-field data, reconstruct the vector.
Arguments
a: First operand (data literal).b: Second operand (data literal).::Type: Time dependence type (unused).::Type: Variable dependence type (unused).::Val: Whether to check time dependence (unused).::Val: Whether to check variable dependence (unused)._: AD backend expression (unused).
Returns
Vector{Any}: Reconstructed 2-element vector from the literal operands.
_poisson_mac [Function]
CTLie._poisson_mac Function
Runtime dispatch for Poisson bracket macro expansion — typed method.
Normalizes operands, checks trait consistency, and calls CTLie.Poisson.
Arguments
h::_Poissonable: First Hamiltonian operand (Function or AbstractHamiltonian).g::_Poissonable: Second Hamiltonian operand (Function or AbstractHamiltonian).::Type{TD}: Time dependence type.::Type{VD}: Variable dependence type.has_aut::Val: Whether to check time dependence.has_var::Val: Whether to check variable dependence.backend: AD backend expression.
Returns
- Result of
CTLie.Poissoncall.
Runtime dispatch for Poisson bracket macro expansion — error for two VectorField operands.
Disambiguator overload for the case when both operands are AbstractVectorField, which would otherwise be ambiguous between the two one-sided error overloads.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Lie bracket.
Runtime dispatch for Poisson bracket macro expansion — error for VectorField as first operand.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Lie bracket.
Runtime dispatch for Poisson bracket macro expansion — error for VectorField as second operand.
Throws
Exceptions.IncorrectArgument: Always thrown with suggestion to use Lie bracket.
_resolve_backend [Function]
CTLie._resolve_backend Function
Resolve the AD backend from a keyword argument.
If NotProvided, returns the global backend. If an ADTypes backend, builds a fresh backend from the ADType.
Arguments
::CTBase.Core.NotProvidedType: Sentinel value indicating no backend specified.ad_backend::ADTypes.AbstractADType: ADTypes backend type to build.
Returns
Differentiation.AbstractADBackend: The resolved backend.