cirq.SingleQubitMatrixGate

class cirq.SingleQubitMatrixGate(matrix: numpy.ndarray)[source]

A 1-qubit or qudit gate defined by its matrix.

More general than specialized classes like ZPowGate, but more expensive
and more float-error sensitive to work with (due to using
eigendecompositions).
__init__(matrix: numpy.ndarray) → None[source]

Initializes the 2-qubit matrix gate.

Parameters

matrix – The matrix that defines the gate.

Methods

controlled_by(*control_qubits[, control_values])

Returns a controlled version of this gate.

num_qubits()

The number of qubits this gate acts on.

on(*qubits)

Returns an application of this gate to the given qubits.

on_each(*targets)

Returns a list of operations applying the gate to all targets.

validate_args(qubits)

Checks if this gate can be applied to the given qubits.

wrap_in_linear_combination([coefficient])