geope.jax.jacobian¤
geope.jax.jacobian.Ui(x, basis)
¤
Compute a unitary from a linear combination of Hermitian basis matrices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Coefficient vector of shape |
required |
basis
|
Array
|
Array of Hermitian matrices of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
A unitary matrix of shape |
geope.jax.jacobian.get_Ui_fn(basis)
¤
Create a partial unitary function with a fixed basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
Array
|
Array of Hermitian matrices of shape |
required |
Returns:
| Type | Description |
|---|---|
Callable[[Array], Array]
|
A callable that takes a coefficient vector and returns |
Callable[[Array], Array]
|
the corresponding unitary. |
geope.jax.jacobian.manual_jacobian(params, Ui_fn, jac_fn)
¤
Compute the full Jacobian of the product unitary manually.
The product unitary follows the convention of
:func:geope.engine.compute_matrices_params_list_fn, where each gate is
left-multiplied onto the accumulator,
The derivative with respect to a parameter of gate \(i\) leaves every other gate untouched, so it is a product with a single factor replaced by the per-gate derivative:
Both the left (\(L_i\), exclusive suffix product) and right (\(R_i\), exclusive
prefix product) partial products are obtained in \(O(G)\) matrix
multiplications with two jax.lax.scan passes, after which the per-gate
derivative blocks are combined with a single vectorised einsum. This is
the equivalent of differentiating the whole sequence with autodiff, but
built explicitly from the per-gate derivative jac_fn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Array
|
Parameter |
required |
Ui_fn
|
Callable[[Array], Array]
|
Callable mapping a coefficient |
required |
jac_fn
|
Callable[[Array], Array]
|
Callable computing the per-gate Jacobian |
required |
Returns:
| Type | Description |
|---|---|
Array
|
An |
geope.jax.jacobian.get_jacobian_propagator(gate_basis, hermitian=True)
¤
Create a JIT-compiled manual Jacobian function for a given gate basis.
The per-gate derivative uses the spectral method (geope.jax.dexpm_eig),
and the returned function is wrapped in jax.jit so it is compiled once
and reused across calls (rather than retracing on every invocation).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gate_basis
|
Array
|
|
required |
hermitian
|
bool
|
Assume real parameters (skew-Hermitian generators) and use
the faster |
True
|
Returns:
| Type | Description |
|---|---|
Callable[[Array], Array]
|
A |
Callable[[Array], Array]
|
of shape |
Callable[[Array], Array]
|
|