# cirq.ApplyUnitaryArgs¶

class cirq.ApplyUnitaryArgs(target_tensor: numpy.ndarray, available_buffer: numpy.ndarray, axes: Iterable[int])[source]

Arguments for performing an efficient left-multiplication by a unitary.

The receiving object is expected to mutate target_tensor so that it
contains the state after multiplication, and then return target_tensor.
Alternatively, if workspace is required, the receiving object can overwrite
available_buffer with the results and return available_buffer. Or, if
the receiving object is attempting to be simple instead of fast, it can
create an entirely new array and return that.
target\_tensor
The input tensor that needs to be left-multiplied by
the unitary effect of the receiving object. The tensor will
have the shape (2, 2, 2, …, 2). It usually corresponds to
a multi-qubit superposition, but it could also be a multi-qubit
unitary transformation or some other concept.
available\_buffer
Pre-allocated workspace with the same shape and
dtype as the target tensor.
axes
Which axes the unitary effect is being applied to (e.g. the
qubits that the gate is operating on).
__init__(target_tensor: numpy.ndarray, available_buffer: numpy.ndarray, axes: Iterable[int])[source]
Parameters
• target_tensor – The input tensor that needs to be left-multiplied by the unitary effect of the receiving object. The tensor will have the shape (2, 2, 2, …, 2). It usually corresponds to a multi-qubit superposition, but it could also be a multi-qubit unitary transformation or some other concept.

• available_buffer – Pre-allocated workspace with the same shape and dtype as the target tensor.

• axes – Which axes the unitary effect is being applied to (e.g. the qubits that the gate is operating on).

Methods

 default([num_qubits, qid_shape]) A default instance starting in state |0⟩. subspace_index([little_endian_bits_int, …]) An index for the subspace where the target axes equal a value. Returns a transposed view of the same arguments.