apply_gate

qujax.apply_gate(statetensor, gate_unitary, qubit_inds)

Applies gate to statetensor and returns updated statetensor. Gate is represented by a unitary matrix in tensor form.

Parameters:
  • statetensor (ndarray) – Input statetensor.

  • gate_unitary (ndarray) – Unitary array representing gate must be in tensor form with shape (2,2,…).

  • qubit_inds (Sequence[int]) – Sequence of indices for gate to be applied to. Must have 2 * len(qubit_inds) = gate_unitary.ndim

Returns:

Updated statetensor.

Return type:

ndarray