ket.qint

Quantum integer data structure.

Classes ket.qint

Qint

A quantum integer data structure.

Qreal

A quantum real data structure using fixed-point representation.

class Qint(qubits, number: int = 0)

A quantum integer data structure.

A specialized case of Qreal where the exponent is strictly 0.

Parameters:
  • qubits – The quantum register to allocate for this number.

  • number – The initial classical integer value. Defaults to 0.

postprocessing()

Returns a function to convert the internal integer state back to a int.

class Qreal(qubits: Quant, exp, number: float = 0.0)

A quantum real data structure using fixed-point representation.

This class represents a real number encoded within a quantum register. It provides a high-level interface for quantum arithmetic, supporting in-place addition, subtraction, multiplication, and division.

Parameters:
  • qubits – The quantum register to allocate for this number.

  • exp – The exponent defining the fixed-point scale (value x 2**exp).

  • number – The initial classical float value to set the quantum register to. Defaults to 0.0.

copy()

Copies the quantum state into a new Qreal register.

mul(other, result)

Performs quantum multiplication.

Multiplies the Qreal self (multiplier) by other (multiplicand) and accumulates the product into the result Qreal.

Parameters:
  • other – The multiplicand (can be a classical scalar or another Qreal).

  • result – The target quantum register where the product is accumulated.

postprocessing()

Returns a function to convert the internal integer state back to a float.

dump_format()

Format for dump.

Used internally em calling dump.