geope.parameters¤
geope.parameters.Parameters
¤
Central state object for the Basis -> Parameters -> Optimizer pipeline.
Holds the system description (basis, control/drift Hamiltonians, target),
optimisation config (constraints, bounds, param_transform), and the
live optimisation state (parameters, fidelity) that an optimiser
such as Geope updates in place.
Attributes:
| Name | Type | Description |
|---|---|---|
basis |
Full |
|
projected_basis |
The controllable sub- |
|
drift_basis |
The drift sub- |
|
target |
Target unitary as |
|
piecewise_steps |
Number of piecewise-constant gate segments. |
|
fixed_drift |
Whether the drift contribution is held fixed. |
|
control |
The control dict used to build |
|
drift_config |
The dict used to build |
|
pulse_constraints |
Optional pulse-shape constraint config. |
|
param_transform |
Optional callable mapping experimental params to basis coefficients. |
|
projective |
Whether to optimise with the projective (SU)
fidelity ( |
|
n_experimental_params |
Length of the experimental-parameter
vector when |
|
constraint_arrays |
List of linear-equality constraint vectors, after merging. |
|
constraint_expander |
Expansion matrix that maps free parameters into the projected basis under the constraints. |
|
bounds |
Pre-built bounds, or |
|
drift_parameters |
Drift parameter |
|
seed |
Optional random seed. |
|
init_spread |
Half-width of the uniform initial-parameter sampling. |
|
parameters |
Current parameter |
|
fidelity |
Current fidelity value, or |
|
infidelity |
|
projected_indices
cached
property
¤
Boolean mask for the projected basis within the full basis.
drift_indices
cached
property
¤
Boolean mask for the drift basis within the full basis.
All-False when there is no drift basis.
proj_drift_indices
cached
property
¤
Combined boolean mask for projected and drift elements.
proj_drift_basis
cached
property
¤
Combined projected-and-drift Basis object.
proj_indices_projdrift_basis
cached
property
¤
Projected indices expressed within the combined proj+drift basis.
drift_indices_projdrift_basis
cached
property
¤
Drift indices expressed within the combined proj+drift basis.
compute_U_fn
cached
property
¤
Unitary-from-parameters function (wrapped when param_transform set).
fid_U_fn
cached
property
¤
Fidelity-of-unitary function bound to target.
infid_U_fn
cached
property
¤
Infidelity-of-unitary function bound to target.
infid_fn
cached
property
¤
Infidelity as a function of the free parameters.
grad_fn
cached
property
¤
Value-and-gradient of the infidelity (used by GRAPE).
hess_fn_autodiff
cached
property
¤
Hessian of the infidelity (used by GRAPE).
hess_fn
cached
property
¤
Manual (Goodwin–Kuprov) Hessian of the infidelity.
Analytic drop-in for hess_fn, built from the manual propagator
derivatives instead of autodiff. Only available without a
param_transform (the manual derivatives operate directly on the
proj+drift basis coefficients).
jac_fn
cached
property
¤
Jacobian of the unitary w.r.t. the free parameters.
Holomorphic autodiff in projected-basis mode; a real/imag-split
Jacobian when param_transform is set (so the imaginary part is not
discarded through the real-valued user transform).
geo_fn
cached
property
¤
Geodesic-Hamiltonian function bound to target (used by GEOPE).
project_omegas_fn
cached
property
¤
Projection of matrices onto the Lie-algebra basis (used by GEOPE).
gammas_and_omegas
cached
property
¤
Combined gammas-and-omegas function for the GEOPE update step.
In param_transform (experimental) mode the omega projection has one
free column per experimental parameter, so the projected-index
restriction selects all of them.
__dict__
class-attribute
¤
__doc__
class-attribute
¤
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__
class-attribute
¤
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__weakref__
property
¤
list of weak references to the object
basis_coefficients
property
¤
Current parameters mapped through param_transform if set.
Returns the induced basis coefficients corresponding to the
current self.parameters. If param_transform is None
this is just the current parameters.
infidelity
property
¤
1 - fidelity, or None before a run has computed it.
__init__(basis=None, control=None, drift=None, projected_basis=None, drift_basis=None, init_values=None, drift_values=None, target=None, piecewise_steps=1, fixed_drift=True, constraints=None, pulse_constraints=None, bounds=None, init_spread=0.1, seed=None, param_transform=None, n_experimental_params=None, projective=True)
¤
Initialise a Parameters bundle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
Basis | None
|
Full |
None
|
control
|
dict | None
|
Dict of allowed controllable interactions, e.g.
|
None
|
drift
|
dict | None
|
Dict of fixed drift interactions, same format.
Mutually exclusive with |
None
|
projected_basis
|
Basis | None
|
Pre-built projected |
None
|
drift_basis
|
Basis | None
|
Pre-built drift |
None
|
init_values
|
dict | ndarray | None
|
Initial parameter values. May be a dict in the
same format as |
None
|
drift_values
|
dict | ndarray | None
|
Drift parameter values. May be a dict or array. |
None
|
target
|
ndarray | None
|
Target unitary. |
None
|
piecewise_steps
|
int
|
Number of piecewise-constant gate segments. Defaults to 1. |
1
|
fixed_drift
|
bool
|
Whether the drift contribution is held fixed.
Defaults to |
True
|
constraints
|
list | None
|
Optional list of linear-equality constraints,
each either an |
None
|
pulse_constraints
|
dict | list | None
|
Optional pulse-shape constraints whose
temporal profile is frozen during optimisation. In
projected space, a control-format dict
|
None
|
bounds
|
dict | None
|
Optional dict mapping interaction label to
|
None
|
init_spread
|
float
|
Half-width of uniform initialisation. Defaults to 0.1. |
0.1
|
seed
|
int | Array | None
|
Optional random seed. Defaults to |
None
|
param_transform
|
Callable | None
|
Optional callable mapping experimental
params to basis coefficients. May take
|
None
|
n_experimental_params
|
int | None
|
Number of experimental parameters
when |
None
|
projective
|
bool
|
If |
True
|
to_dict()
¤
Export the current basis coefficients as a control-style dict.
Returns a dict keyed by qubit index (or qubit-index tuple) whose values are dicts mapping lower-case interaction labels to real coefficient values.
geope.utils.make_per_element_transform(transforms)
¤
Build a param_transform from per-element callables.
Each entry of transforms maps a single experimental parameter
to a single basis coefficient. Use None to mean identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transforms
|
list[Callable | None]
|
List of callables (or |
required |
Returns:
| Type | Description |
|---|---|
Callable
|
A callable mapping a |
Callable
|
suitable for |
Example
transforms = [lambda x: jnp.exp(1j*x), jnp.cos, None].
geope.utils.filter_basis_by_control(basis, control)
¤
Filter a Basis keeping only operators that match a control dict.
For each basis element, inspect its label, build the qubit-index key
(a single integer for 1-body terms, a tuple for multi-body) and the
lower-case interaction label, then keep the element only if
control[key] lists the interaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
Basis
|
The full |
required |
control
|
dict
|
Dict mapping qubit index (or tuple of indices) to a
list of interaction labels, e.g. |
required |
Returns:
| Type | Description |
|---|---|
Basis
|
A new |
Basis
|
returned basis preserves |