tlquantum.tt_gates.Unitary

class tlquantum.tt_gates.Unitary(gates, nqubits, ncontraq, contrsets=None, dtype=torch.complex64, device=None)[source]

A unitary for all qubits in a TTCircuit, using tensor ring tensors with PyTorch Autograd support. Can be defined with arbitrary gates or used as a base-class for set circuit types.

Parameters:
gateslist of TT gate classes, each qubit in the unitary

to be involved in one gate.

nqubitsint, number of qubits
ncontraqint, number of qubits to do pre-contraction over

(simplifying contraciton path/using fewer indices)

contrsetslist of lists of ints, the indices of qubit cores to

merge in the pre-contraction path.

devicestring, device on which to run the computation.
Returns:
Unitary

Methods

forward()

Prepares the tensors of Unitary for forward contraction by calling the gate instances' forward method and doing qubit-wise (horizonal) pre-contraction.

forward()[source]

Prepares the tensors of Unitary for forward contraction by calling the gate instances’ forward method and doing qubit-wise (horizonal) pre-contraction.

Returns:
List of pre-contracted gate tensors for general forward pass.