MatrixGate(matrix: numpy.ndarray, *, qid_shape: Optional[Iterable[int]] = None)¶
A unitary qubit or qudit gate defined entirely by its matrix.
__init__(matrix: numpy.ndarray, *, qid_shape: Optional[Iterable[int]] = None) → None¶
Initializes a matrix gate.
matrix – The matrix that defines the gate.
qid_shape – The shape of state tensor that the matrix applies to. If not specified, this value is inferred by assuming that the matrix is supposed to apply to qubits.
controlled([num_controls, control_values, …])Returns a controlled version of this gate. If no arguments are
The number of qubits this gate acts on.
Returns an application of this gate to the given qubits.
Checks if this gate can be applied to the given qubits.