|  View source on GitHub | 
Target gateset accepting √iSWAP + single qubit rotations + measurement gates.
Inherits From: TwoQubitCompilationTargetGateset, CompilationTargetGateset, Gateset
cirq.SqrtIswapTargetGateset(
    *,
    atol: float = 1e-08,
    required_sqrt_iswap_count: (int | None) = None,
    use_sqrt_iswap_inv: bool = False,
    additional_gates: Sequence[type[cirq.Gate] | cirq.Gate | cirq.GateFamily] = ()
)
Used in the notebooks
| Used in the tutorials | 
|---|
By default, cirq.SqrtIswapTargetGateset will accept and compile unknown gates to
the following universal target gateset:
- cirq.SQRT_ISWAP/- cirq.SQRT_ISWAP_INV: The two qubit entangling gate.
- cirq.PhasedXZGate: Single qubit rotations.
- cirq.MeasurementGate: Measurements.
- cirq.GlobalPhaseGate: Global phase.
Optionally, users can also specify additional gates / gate families which should
be accepted by this gateset via the additional_gates argument.
When compiling a circuit, any unknown gate, i.e. a gate which is not accepted by
this gateset, will be compiled to the default gateset (i.e. cirq.SQRT_ISWAP/
cirq.cirq.SQRT_ISWAP_INV, cirq.PhasedXZGate, cirq.MeasurementGate).
| Args | |
|---|---|
| atol | A limit on the amount of absolute error introduced by the decomposition. | 
| required_sqrt_iswap_count | When specified, the decompose_to_target_gatesetwill
decompose each operation into exactly this many sqrt-iSWAP gates even if fewer is
possible (maximum 3). A ValueError will be raised if this number is 2 or lower and
synthesis of the operation requires more. | 
| use_sqrt_iswap_inv | If True, cirq.SQRT_ISWAP_INVis used as part of the gateset,
instead ofcirq.SQRT_ISWAP. | 
| additional_gates | Sequence of additional gates / gate families which should also be "accepted" by this gateset. This is empty by default. | 
| Raises | |
|---|---|
| ValueError | If required_sqrt_iswap_countis specified and is not 0, 1, 2, or 3. | 
Methods
decompose_to_target_gateset
decompose_to_target_gateset(
    op: cirq.Operation, moment_idx: int
) -> DecomposeResult
Method to rewrite the given operation using gates from this gateset.
| Args | |
|---|---|
| op | cirq.Operationto be rewritten using gates from this gateset. | 
| moment_idx | Moment index where the given operation opoccurs in a circuit. | 
| Returns | |
|---|---|
| 
 | 
validate
validate(
    circuit_or_optree: (cirq.AbstractCircuit | op_tree.OP_TREE)
) -> bool
Validates gates forming circuit_or_optree should be contained in Gateset.
| Args | |
|---|---|
| circuit_or_optree | The cirq.Circuitorcirq.OP_TREEto validate. | 
with_params
with_params(
    *, name: (str | None) = None, unroll_circuit_op: (bool | None) = None
) -> Gateset
Returns a copy of this Gateset with identical gates and new values for named arguments.
If a named argument is None then corresponding value of this Gateset is used instead.
| Args | |
|---|---|
| name | New name for the Gateset. | 
| unroll_circuit_op | If True, new Gateset will recursively validate cirq.CircuitOperationby validating the underlyingcirq.Circuit. | 
| Returns | |
|---|---|
| selfif all new values are None or identical to the values of current Gateset.
else a new Gateset with identical gates and new values for named arguments. | 
__contains__
__contains__(
    item: (raw_types.Gate | raw_types.Operation)
) -> bool
Check for containment of a given Gate/Operation in this Gateset.
Containment checks are handled as follows:
- For Gates or Operations that have an underlying gate (i.e. op.gate is not None):
- Forwards the containment check to the underlying cirq.GateFamilyobjects.
- Examples of such operations include cirq.GateOperations and their controlled and tagged variants (i.e. instances ofcirq.TaggedOperation,cirq.ControlledOperationwhereop.gateis not None) etc.
 
- Forwards the containment check to the underlying 
- For Operations that do not have an underlying gate:
- Forwards the containment check to self._validate_operation(item).
- Examples of such operations include cirq.CircuitOperations and their controlled and tagged variants (i.e. instances ofcirq.TaggedOperation,cirq.ControlledOperationwhereop.gateis None) etc.
 
- Forwards the containment check to 
The complexity of the method in terms of the number of gates, n, is
- O(1) when any default cirq.GateFamilyinstance accepts the given item, except for an Instance GateFamily trying to match an item with a different global phase.
- O(n) for all other cases: matching against custom gate families, matching across global phase for the default Instance GateFamily, no match against any underlying gate family.
| Args | |
|---|---|
| item | The cirq.Gateorcirq.Operationinstance to check containment for. | 
__eq__
__eq__(
    other: _SupportsValueEquality
) -> bool
__ne__
__ne__(
    other: _SupportsValueEquality
) -> bool