qat.utils.state_tensors module

class StateOperator(num_qubits)

Bases: StateTensor

Represents a unitary operator for discrete quantum many-body quantum systems.

A generalisation of StateVector to matrix-like objects, which has rank \(2N\). Is initialized to be an identity matrix, which can be “evolved” by gates to represent a quantum circuit.

Initiate the the operator as the identity matrix.

apply_gate(gate)

Apply a gate to the operator.

Return type:

StateOperator

class StateTensor

Bases: ABC

A tensorial description of quantum-related objects, such as quantum states and unitary operators.

Quantum many-body states with a discrete Hilbert space can be represented exactly using so state vector approaches, where the vector elements describe the probability amplitude for a particular state. The same concept can naturally be extended to described mixed states and quantum operations (unitary, non-unitary and quantum channels alike).

This object is a minimal implementation of this type of reasoning. For now it is used purely for testing the higher parts of our compilation stack (hence its perhaps misplaced location in the utils package), such as gate-level optimisations. Its capabilities will be extended as required, and it could potentially be used to implement an in-house gate-level simulator later down the line…

class StateVector(num_qubits)

Bases: StateTensor

Represents the wavefunction of a discrete quantum many-body state.

The wavefunction can be represented as a \(d^{N}\) vector for a system with \(N\) constituents each with local dimension \(d^{N}\), which is \(d=2\) for qubits. However, a more convenient (and entirely equivalent) way to represent this is actually as a \((d, d, \dots, d, d)\)-tensor (with total rank \(N\)). This allows to do calculations using local operations (such as a 1Q or 2Q gate, or a measurement) without calculating the operation for the full Hilbert space, reducing the computational complexity of the operation. Note that while the cost is still exponential in \(N\), it can be done with a smaller exponent, allowing for more performant numerics.

This object currently just represents the state an has implementations for basic application of quantum gates: this will be extended as needed.

Initiate the state with all qubits in their lowest-energy state.

apply_gate(gate)

Apply a gate to the quantum state.

Return type:

StateVector