qat.qpus.CLinalg

The quantum state is stored as a complex valued vector of length \(2^{N}\), with each element being the complex amplitude of the particular state:

\[\vert\psi\rangle = \sum_{i=0}^{2^{N}}a_{i}|i\rangle\]

where \(|i\rangle\) represents a computational basis state.

Quantum gates are manipulated as complex valued matrices. Applying a gate consists in selecting the groups of \(2^{arity}\) amplitudes in the state vector, and doing a dot product of each group with the matrix representing the gate.

High-level Quantum Processing Unit

This high-level class wrapping the simulator follows the convention of the qat.qpus.QPUHandler structure.

C++ Low-level Statevector

Though not the standard or recommended way of using qat.qpus.CLinalg, the C++ statevector object underneath this QPU can be accessed throught the statevector parameter, for instance:

from qat.clinalg import CLinalg
qpu = CLinalg()
# change number of qubits to 2
qpu.statevector.resize(2)
# reset the state to |00> and print the state
qpu.statevector.reset()
qpu.statevector.print()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'CLinalg' from 'qat.clinalg' (unknown location)

Warning

Do consider that the bit convention used in this lower-level statevector is reversed compared to the more intuitive one supported by the QPU interface. Intuitively, you will consider a state \(|i_0i_1i_2i_3\rangle\) (with qubit 0 being the most significant bit); however the ordering used by the low-level statevector instance \(|i_3i_2i_1i_0\rangle\) (with qubit 0 being the least significant bit). This influences the statevector methods print, reset (if a value is provided) and the way in which the statevector is interacted with through the array property.

Pybind interface