View source on GitHub
|
A two-qubit gate compiler based on numerical optimization (NuOp).
cirq.TwoQubitNumericalCompiler(
base_gates: tuple[np.ndarray, ...],
base_gate_error_rates: (tuple[float, ...] | None) = None,
target_fidelity: (float | None) = None,
max_layers: int = 3,
single_qubit_error_rates: (float | tuple[float, float] | None) = None,
num_restarts: int = 5,
maxiter: int = 1000,
max_cache_size: int = 128,
random_state: cirq.RANDOM_STATE_OR_SEED_LIKE = None
)
Holds a fixed set of hardware base gates (and optionally their error
rates) so that arbitrary two-qubit unitaries can be compiled repeatedly
with the same configuration via compile_two_qubit_gate. See
cirq.two_qubit_gate_numerical_compilation for details of the algorithm.
This class supports JSON serialization, but only when random_state is
None or an integer seed; a live numpy random generator cannot be
serialized.
Methods
compile_two_qubit_gate
compile_two_qubit_gate(
unitary: np.ndarray
) -> TwoQubitNumericalCompilationResult
Compile the given 4x4 unitary onto this compiler's base gate(s).
Results are memoized (least-recently-used, up to max_cache_size
entries): compiling a unitary whose entries are all within 1e-10 of
a cached unitary returns the cached result instead of re-running the
numerical optimization, so unitaries differing only by
floating-point noise (e.g. from different fusion orders) still hit.
__eq__
__eq__(
other
) -> bool
Return self==value.
Class Variables | |
|---|---|
| base_gate_error_rates |
None
|
| max_cache_size |
128
|
| max_layers |
3
|
| maxiter |
1000
|
| num_restarts |
5
|
| random_state |
None
|
| single_qubit_error_rates |
None
|
| target_fidelity |
None
|
View source on GitHub