View source on GitHub |
GateFamily which accepts instances of cirq.ParallelGate
and its sub_gate.
Inherits From: GateFamily
cirq.ParallelGateFamily(
gate: Union[Type[raw_types.Gate], raw_types.Gate],
*,
name: Optional[str] = None,
description: Optional[str] = None,
max_parallel_allowed: Optional[int] = None
) -> None
ParallelGateFamily is useful for description and validation of scenarios where multiple
copies of a unitary gate can act in parallel. cirq.ParallelGate
is used to express
such a gate with a corresponding unitary sub_gate
that acts in parallel.
ParallelGateFamily supports initialization via:
- Gate Instances that can be applied in parallel.
- Gate Types whose instances can be applied in parallel.
In both the cases, the users can specify an additional parameter max_parallel_allowed
which
is used to verify the maximum number of qubits on which any given gate instance can act on.
To verify containment of a given cirq.Gate
instance g
, the gate family verfies that:
cirq.num_qubits(g)
<=max_parallel_allowed
ifmax_parallel_allowed
is not None.g
org.sub_gate
(ifg
is an instance ofcirq.ParallelGate
) is an accepted gate based on type or instance checks depending on the initialization gate type.
Args | |
---|---|
gate
|
The gate which can act in parallel. It can be a python type inheriting from
cirq.Gate or a non-parameterized instance of a cirq.Gate . If an instance of
cirq.ParallelGate is passed, then the corresponding gate.sub_gate is used.
|
name
|
The name of the gate family. |
description
|
Human readable description of the gate family. |
max_parallel_allowed
|
The maximum number of qubits on which a given gate g
can act on. If None, then any number of qubits are allowed.
|
Attributes | |
---|---|
description
|
|
gate
|
|
name
|
|
tags_to_accept
|
|
tags_to_ignore
|
Methods
__contains__
__contains__(
item: Union[cirq.Gate
, cirq.Operation
]
) -> bool
__eq__
__eq__(
other: _SupportsValueEquality
) -> bool
__ne__
__ne__(
other: _SupportsValueEquality
) -> bool