API reference
tlquantum
: Quantum ML
Density Tensors
TensorLyQuantum provides a convenient class for representing and manipulating density tensors:

A quantum state container for state and density matrix operations, including partial traces and quantum information metric calculations. 
TensorTrains
Also known as MPO, MPS, tensortrain is an efficient way to represent statevectors and operators in factorized form. In TensorLyQuantum, we provide outofthebox layers and circuits in the TT format.
Gates in TTform

A unitary for all qubits in a TTCircuit, using tensor ring tensors with PyTorch Autograd support. 

Identity gate (does not change the state of the qubit on which it acts). 

Qubit rotations about the Yaxis with randomly initiated theta. 

A Unitary subclass that generates a layer of unitary, singlequbit rotations. 

A Unitary subclass that generates a layer of a single twoqubit gates accross all qubits in a TTCircuit. 

Left (controlqubit) core of a CZ gate. 

Right (transformed qubit) core of a CZ gate. 

Left (controlqubit) core of a CNOT gate. 

Right (transformed qubit) core of a CNOT gate. 

Left or right core of the twoqubit SO4 rotations gate. 
We also provide some convenience functions to facilitate creation of some of the gates:

Pair of CZ class instances, one left (control) and one right (transformed). 

Pair of CNOT class instances, one left (control) and one right (transformed). 

Pair of SO4 twoqubit rotation class instances, with rotations over different states. 
Operators in TTform

Generates tttensor unitary of one singlequbit operator per qubit. 

Generates tttensor classical Ising model Hamiltonian (twoqubit interaction terms in a single basis). 

Singlequbit identity opertor in the tttensor format. 

Singlequbit PauliX opertor in the tttensor format. 

Singlequbit PauliZ opertor in the tttensor format. 
States in TTform

Generates tttensor state of computational basis product space described by spins. 

The norm of a TTtensor state. 
Creating circuits

A simulator for variational quantum circuits using tensor ring tensors with PyTorch Autograd support. 
Adding TT/MPS/MPOs

Sums two TT tensors in decomposed form 

Sums two TT matrices in decomposed form 
Contracting Tensor Networks

Generates einsum contraciton equation. 
Precontraction

Contracts lists (layers) of tttensor cores horizontally (merging multiple cores in a single layer) up to some maximum number of qubits. 

Contracts sublists of a list of layers vertically (merging cores of multiple layers for a single qubit) up to some maximum contraction depth. 
Solving MaxCut

Calculates the MaxCut value of a given state (set of spins) for a given graph (weights). 

Brute force calculation of MaxCut for a given set of spins and weights. 