Skip to content

workbench_algorithms.subroutines.data_loading.unary_qrom

Qubricks for implementing unary data loaders.

UnaryQROM

UnaryQROM(**kwargs)

Bases: Qubrick

A unary-encoded data-loader.

This class provides a unary QROM (Quantum Read-Only Memory) data loader, which can be used to encode data into quantum registers.

Parameters:

Name Type Description Default
**kwargs dict[str, Any]

Additional keyword arguments passed to the Qubrick superclass.

{}

compute

compute(
    index_reg: Qubits,
    b_of_p: int,
    data: list,
    ctrl: int | Qubits = 0,
    *,
    clean: Qubits | None = None,
)

This method loads the given data into the quantum register using unary encoding.

Parameters:

Name Type Description Default
index_reg Qubits

The index register, encoded in unary.

required
b_of_p int

The number of bits of precision per item to be loaded.

required
data list

A list of integers representing the data to be loaded.

required
ctrl int | Qubits

A control register for conditional loading. Defaults to 0.

0
clean Qubits | None

Qubits encoding the output data. If left as None, the register is allocated on the fly.

None