geope.parameters¤
geope.parameters.Parameters
¤
Central state object for the parameters of the system.
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. |
|
delta_t |
Duration of each segment. |
|
total_time |
|
|
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. |
|
manifold |
The |
|
projective |
Whether the geometry is the projective (SU) one.
Read-only; delegates to |
|
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.
__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.
projective
property
¤
Whether the geometry is the projective (SU) one.
Delegates to the manifold, which is the single place the choice lives.
total_time
property
¤
Total gate duration piecewise_steps * delta_t.
__init__(basis=None, control=None, drift=None, projected_basis=None, drift_basis=None, init_values=None, drift_values=None, target=None, piecewise_steps=1, delta_t=1.0, fixed_drift=True, constraints=None, pulse_constraints=None, bounds=None, init_spread=0.1, seed=None, param_transform=None, n_experimental_params=None, manifold=None)
¤
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
|
delta_t
|
float
|
Duration \(\Delta t\) of each segment, so that
\(U_g = \exp(-i\,\Delta t\,H_g)\). Defaults to |
1.0
|
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
|
manifold
|
Manifold | None
|
The |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
free(parameters=None)
¤
The free (proj+drift) parameter columns, in the pipeline's dtype.
The single owner of the "which columns does the optimiser move, and in
what dtype" question that Geope, Gecko and Grape all need. Identity
in experimental (param_transform) mode, where every column is already
free and the dtype is real; otherwise selects the proj+drift columns of
the full-basis array and promotes to complex128 for the holomorphic
Jacobian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
ndarray | Array | None
|
A full-basis parameter array. Defaults to the live
|
None
|
Returns:
| Type | Description |
|---|---|
Array
|
An |
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 |