UnitaryGateCriteria

class braket.circuits.noise_model.unitary_gate_criteria.UnitaryGateCriteria(unitary, qubits=None)[source]

Bases: CircuitInstructionCriteria

This class models noise Criteria based on unitary gates represented as a matrix.

Parameters:
  • unitary (Unitary)

  • qubits (Union[Qubit, int, Iterable[Union[Qubit, int]], None])

Creates unitary gate-based Criteria. See instruction_matches() for more details.

Parameters:
  • unitary (Unitary) – A unitary gate matrix represented as a Braket Unitary.

  • qubits (QubitSetInput | None) – A set of relevant qubits. If no qubits are provided, all (possible) qubits are considered to be relevant.

Raises:

ValueError – If unitary is not a Unitary type.

applicable_key_types()[source]

Returns keys based on criterion.

Return type:

Iterable[CriteriaKey]

Returns:

Iterable[CriteriaKey] – This Criteria operates on unitary gates and Qubits.

get_keys(key_type)[source]

Gets the keys for a given CriteriaKey.

Parameters:

key_type (CriteriaKey) – The relevant Criteria Key.

Return type:

CriteriaKeyResult | set[Any]

Returns:

CriteriaKeyResult | set[Any] – The return value is based on the key type: UNITARY_GATE will return a set containing the bytes of the unitary matrix representing the unitary gate. QUBIT will return a set of qubit targets that are relevant to this Criteria, or CriteriaKeyResult.ALL if the Criteria is relevant for all (possible) qubits. All other keys will return an empty list.

to_dict()[source]

Converts a dictionary representing an object of this class into an instance of this class.

Return type:

dict

Returns:

dict – A dictionary representing the serialized version of this Criteria.

instruction_matches(instruction)[source]

Returns true if an Instruction matches the criteria.

Parameters:

instruction (Instruction) – An Instruction to match.

Return type:

bool

Returns:

bool – Returns true if the operator is one of the Unitary gates provided in the constructor and the target is a qubit (or set of qubits) provided in the constructor. If qubits were not provided in the constructor, then this method will ignore the Instruction target.

classmethod from_dict(criteria)[source]

Deserializes a dictionary into a Criteria object.

Parameters:

criteria (dict) – A dictionary representation of a UnitaryGateCriteria.

Return type:

Criteria

Returns:

Criteria – A deserialized UnitaryGateCriteria represented by the passed in serialized data.