Skip to content

geope.geometry.chart¤

The ambient layer. Every manifold in the library is a submanifold of one ambient space \(\mathcal A = \mathbb C^{N\times m}\), and the pulse acts on all of them the same way — by left multiplication with a product of piecewise-constant exponentials:

\[U(\phi) = \prod_g \exp\Bigl(\sum_k \phi_{g,k} E_k\Bigr), \qquad E_k = -i\,G_k, \qquad \Phi(\phi) = U(\phi)\,x_0 .\]

The chart is therefore the orbit map of that one action through a base point \(x_0 = \Phi(0)\): the identity on a matrix group (where the propagator is the point), a state on StateSphere, a frame on Stiefel. Only \(x_0\) varies, which is why no manifold writes chart code of its own — Manifold.bind composes what is here, once.

This module owns the whole jet \((\Phi,\ \mathrm D\Phi,\ \mathrm D^2\Phi)\), i.e. everything valued in \(\mathcal A\). What happens in the tangent space — the metric, the coefficient frame, the logarithm, the fidelity — is the manifold's, so the two never mix. It imports nothing but JAX and geope.jax, sitting below the manifolds rather than beside them.

Each factory returns an un-jitted callable, so JIT compilation happens once, lazily, when the optimiser's top-level update_step is first traced.

The propagator¤

geope.geometry.chart.compute_matrices_params_list_fn(params_list, basis, delta_t=1.0) ¤

Compute the product unitary from a list of parameter vectors.

For each parameter vector in params_list, constructs the algebra element as a linear combination of the generator array basis, scales it by the segment duration delta_t, exponentiates it, and accumulates the product unitary via jax.lax.scan.

Parameters:

Name Type Description Default
params_list Array

Array of shape (piecewise_steps, K) where each row contains the Lie-algebra coefficients for one gate segment.

required
basis Array

Generator Array of shape (K, d, d).

required
delta_t Array | float

The segment duration, a traced scalar. Defaults to 1.0.

1.0

Returns:

Type Description
Array

The product unitary Array of shape (d, d).

geope.geometry.chart.get_compute_matrices_params_list_fn(basis) ¤

Create a partial unitary-computation function with a fixed generator array.

Parameters:

Name Type Description Default
basis ndarray

Generator array of shape (K, d, d) — skew-Hermitian in the pipeline.

required

Returns:

Type Description
Callable[..., Array]

A Callable[[Array, float], Array] accepting a parameter list and a

Callable[..., Array]

delta_t (defaulting to 1.0), returning the product unitary.

The chart¤

geope.geometry.chart.get_chart_fn(generators, base_point=None) ¤

Build the chart: the pulse's orbit through base_point.

\(\Phi(\phi) = U(\phi)\,x_0\), with \(U\) the propagator above. Since that propagator's jax.lax.scan is seeded at the ambient identity, \(\Phi(0) = x_0\) — the base point is where the chart starts.

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

The point \(x_0 \in \mathcal A\) the pulse drives, of shape ambient_shape. None means the propagator is the point, which is the case on any matrix Lie group; the underlying callable is then returned unchanged, so no multiplication by the identity is introduced on that hot path. The branch is on a Python value and is resolved at trace time.

None

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array], Array] mapping (G, K) parameters to a point

Callable[[Array], Array]

of shape ambient_shape.

The landed jet¤

The whole of \((\mathrm D\Phi,\ \mathrm D\Phi^\intercal,\ \mathrm D^2\Phi)\), built from the propagator recursions in geope.jax and landed on the base point. Right multiplication by \(x_0\) is linear, so it commutes with differentiation and each term lands termwise — which is why a homogeneous space reuses the group's machinery wholesale and no manifold writes chart code of its own.

geope.geometry.chart.get_chart_jacobian_fn(generators, base_point=None) ¤

Build the chart's first differential \(\mathrm D\Phi\), from the propagator.

The manual geope.jax.get_jacobian_propagator — two jax.lax.scan partial products and one per-gate spectral derivative — landed on base_point and transposed into the layout geope.geometry.tangent.TangentBundle declares.

This is the live Jacobian path. get_jacobian_fn is the autodiff equivalent, kept as the reference the tests and benchmarks compare against, and still used through get_split_jacobian_fn on the param_transform path where no exponential-product structure survives.

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

As get_chart_fn — None means the propagator is the point, and only the transpose is applied.

None

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array], Array] mapping (G, K) parameters to the

Callable[[Array], Array]

Jacobian of shape (*ambient_shape, G, K).

Note

Built with hermitian=True: the per-gate derivative diagonalises with eigh, which assumes the pulse coefficients are real. That holds throughout the pipeline — geope.parameters.Parameters.free promotes to complex128 with an exactly-zero imaginary part — but it is an assumption the holomorphic autodiff path did not make.

geope.geometry.chart.get_chart_vjp_fn(generators, base_point=None) ¤

Build the chart's value and pullback \((\Phi,\ \mathrm D\Phi^\intercal)\).

Returns phi -> (point, pullback), in the shape of jax.vjp. The pullback contracts an ambient covector against every column of \(\mathrm D\Phi\) without forming it — see geope.jax.vjp_propagator for why that is \(O(G(d^3 + d^2K))\) rather than \(O(G d^3 K)\), and why the value comes back with it rather than from a second get_chart_fn call that would recompute every gate exponential.

This is what an objective's gradient in parameter space is made of, and the reason geope.geometry.manifold.Manifold.value_and_grad needs no autodiff.

The base point lands on the covector rather than on the differential, using

\[\langle \hat G,\ \mathrm dU\,x_0\rangle = \langle \hat G\,x_0^\dagger,\ \mathrm dU\rangle,\]

which is the same "right multiplication is linear" fact that lets get_chart_hvp_fn land termwise — just read in the opposite direction.

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

As get_chart_fn.

None

Returns:

Type Description
Callable[[Array], tuple[Array, Callable[[Array], Array]]]

A Callable[[Array], tuple[Array, Callable]] taking (G, K)

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

parameters to the point of shape ambient_shape and a callable

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

mapping an ambient covector of that shape to the complex overlaps of

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

shape (G, K). See geope.jax.vjp_propagator for why those are

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

complex rather than already realified.

geope.geometry.chart.get_chart_hvp_fn(generators, base_point=None) ¤

Build the chart's second differential: the jet \((\Phi,\ \mathrm D\Phi[p],\ \mathrm D^2\Phi[p, p])\).

The same landing as get_chart_fn, applied termwise. That it can be applied termwise is the whole reason a homogeneous space reuses the group's propagator machinery wholesale: right multiplication by a constant is linear, so it commutes with differentiation and carries the jet with no manifold-specific code and no linearity contract to uphold.

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

As get_chart_fn — None returns the propagator's own HVP unchanged.

None

Returns:

Type Description
Callable[[Array, Array], tuple[Array, Array, Array]]

A Callable[[Array, Array], tuple[Array, Array, Array]] accepting

Callable[[Array, Array], tuple[Array, Array, Array]]

parameters and a direction, both (G, K), and returning the triple

Callable[[Array, Array], tuple[Array, Array, Array]]

landed on base_point.

geope.geometry.chart.get_chart_hessian_vjp_fn(generators, base_point=None) ¤

Build the chart's value and second-differential pullback \((\Phi,\ \mathrm D^2\Phi^\intercal)\).

Returns phi -> (point, pullback), in the shape of jax.vjp, exactly as get_chart_vjp_fn does one order down and for the same reason. The pullback contracts an ambient covector against every pair of \(\mathrm D^2\Phi\)'s blocks without forming any of them — see geope.jax.hessian_vjp_propagator for the splitting that makes the pair table one Gram matrix of two \(O(G)\)-propagated derivative trajectories, rather than the \(O(G^2K^2d^3)\)-and-\(O(G^2K^2d^2)\) dense tensor get_chart_hessian_fn builds.

This is what an objective's Hessian in parameter space is made of, and the reason geope.geometry.manifold.Manifold.hessian needs neither autodiff nor the dense \(\mathrm D^2\Phi\).

The base point reaches the primitive as its right factor rather than landing on the covector, which is what keeps the contraction \(O(m d)\) per pair instead of \(O(d^2)\) — a factor \(d\) on a state, where \(m = 1\).

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

As get_chart_fn.

None

Returns:

Type Description
Callable[[Array], tuple[Array, Callable[[Array], Array]]]

A Callable[[Array], tuple[Array, Callable]] taking (G, K)

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

parameters to the point of shape ambient_shape and a callable mapping

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

an ambient covector of that shape to the complex overlaps of shape

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

(G, K, G, K) — the row-major (gate, coefficient) layout a caller

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

reshapes to (P, P) with no transpose. See

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

geope.jax.hessian_vjp_propagator for why those are complex rather than

Callable[[Array], tuple[Array, Callable[[Array], Array]]]

already realified.

Note

geope.jax.hessian_vjp_propagator splits the middle product using unitarity, so this is valid only for real pulse coefficients — which is what the pipeline always has, but see the note on get_chart_jacobian_fn.

geope.geometry.chart.get_chart_hessian_fn(generators, base_point=None) ¤

Build the chart's dense second differential \(\mathrm D^2\Phi\), from the propagator.

geope.jax.get_hessian_propagator landed on base_point. Unlike get_chart_hvp_fn, which takes one direction in \(O(G)\), this materialises every pair — \(O(G^2K^2d^3)\) in flops and \(O(G^2K^2d^2)\) in memory.

This is the reference, not the live path, in the same way get_jacobian_fn is: an objective contracts every block against one covector immediately, which get_chart_hessian_vjp_fn does without building them.

Parameters:

Name Type Description Default
generators ndarray

The chart's generator array (K, d, d).

required
base_point Array | None

As get_chart_fn.

None

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array], Array] mapping (G, K) parameters to the

Callable[[Array], Array]

Hessian of shape (G, G, *ambient_shape, K, K).

Note

geope.jax.hessian_propagator builds its off-diagonal blocks using unitarity, so this is valid only for real pulse coefficients — which is what the pipeline always has, but see the note on get_chart_jacobian_fn.

The autodiff Jacobians¤

get_jacobian_fn is the reference the manual path is tested against. get_split_jacobian_fn and get_split_vjp_fn are the param_transform path's only option: a user-supplied transform has no exponential-product structure to pull back through, and its real intermediates would lose their imaginary part under a holomorphic derivative.

geope.geometry.chart.get_jacobian_fn(compute_point_fn) ¤

Build the autodiff Jacobian of the chart w.r.t. parameters.

Returns the holomorphic jax.jacobian of compute_point_fn. The live path is now the manual get_chart_jacobian_fn; this is kept as the reference the tests and benchmarks check it against, and as the basis of get_split_jacobian_fn, which the param_transform path still needs.

Parameters:

Name Type Description Default
compute_point_fn Callable[[Array], Array]

Callable mapping a parameter list to the chart's point.

required

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array, float], Array] returning the Jacobian of the

Callable[[Array], Array]

point with respect to the parameters, at fixed delta_t.

geope.geometry.chart.get_split_jacobian_fn(compute_point_fn) ¤

Build a real/imag-split Jacobian of compute_point_fn.

Used on the param_transform path: differentiating through the real-valued user transform with a holomorphic Jacobian would discard the imaginary part of intermediates, so the point is split into real and imaginary parts, each differentiated, then recombined.

Parameters:

Name Type Description Default
compute_point_fn Callable[[Array], Array]

The (wrapped) experimental-space chart.

required

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array], Array] returning the complex Jacobian.

geope.geometry.chart.get_split_vjp_fn(compute_point_fn) ¤

Build a real/imag-split value-and-pullback of compute_point_fn.

The autodiff counterpart of get_chart_vjp_fn, and the param_transform path's only option: there is no exponential-product structure left to pull back through, and the user's transform must be differentiated as it stands. jax.vjp already has the (value, pullback) shape, and for the same reason — so the value is shared rather than recomputed.

Split for the same reason get_split_jacobian_fn is — real intermediates in the transform would drop the imaginary part under a holomorphic pullback — and returning the same complex \(\mathrm{Tr}(C^\dagger \partial\Phi)\) so that geope.geometry.manifold.Manifold.value_and_grad is one expression on both paths.

Parameters:

Name Type Description Default
compute_point_fn Callable[[Array], Array]

The (wrapped) experimental-space chart.

required

Returns:

Type Description
Callable[[Array], tuple[Array, Callable[[Array], Array]]]

A Callable[[Array], tuple[Array, Callable]], as get_chart_vjp_fn.

The rest of what used to live in engine.py moved to the owner of the mathematics in question:

what where
the fidelity formulas manifolds — they are the group's
the objective's gradient and Hessian, assembled from this jet manifolds — Manifold.value_and_grad / .hessian
the autodiff Hessian and its HVP hessian — geope.jax.hessian
the param_transform chart wrapper geope.parameters — the one place that reads a Parameters