qrisp.QuantumArray.decoder#

QuantumArray.decoder(code_int)[source]#

The decoder method specifies how a QuantumArray turns the outcomes of measurements into human-readable values. It recieves an integer i and returns an OutcomeArray.

Parameters
iint

Integer representing the outcome of a measurement of the qubits of this QuantumArray.

Returns
resnp.ndarray

An array with entries of the type of the results of the .decoder of the qtype of this array.

Examples

We create a QuantumFloat and inspect its decoder:

>>> from qrisp import QuantumArray, QuantumFloat
>>> qtype = QuantumFloat(3)
>>> q_array = QuantumArray(qtype, (2,2))
>>> print(q_array.decoder(1))
[[0 0]
 [0 1]]