PySparQ.pysparq.algorithms.state_preparation

Quantum state preparation based on QRAM binary-tree decomposition.

Classes

StatePrepViaQRAM

Quantum state-preparation operator based on QRAM binary-tree decomposition.

StatePreparation

High-level wrapper managing the full state-preparation pipeline.

Functions

create_state_preparation_demo(→ str)

Return a demo script string for state preparation.

Module Contents

class PySparQ.pysparq.algorithms.state_preparation.StatePrepViaQRAM(qram: object, work_qubit: str, data_size: int, rational_size: int)[source]

Quantum state-preparation operator based on QRAM binary-tree decomposition.

clear_conditions() → StatePrepViaQRAM[source]
conditioned_by_all_ones(cond: str | int | list[str | int]) → StatePrepViaQRAM[source]
conditioned_by_bit(reg: str | int, bit: int) → StatePrepViaQRAM[source]
conditioned_by_nonzeros(cond: str | int | list[str | int]) → StatePrepViaQRAM[source]
dag(state: SparseState) → None[source]
addr_size: int[source]
data_size: int[source]
qram: object[source]
rational_size: int[source]
work_qubit: str[source]
class PySparQ.pysparq.algorithms.state_preparation.StatePreparation(qubit_number: int, data_size: int, data_range: int)[source]

High-level wrapper managing the full state-preparation pipeline.

get_fidelity() → float[source]

Compute the fidelity between the prepared state and the target state.

get_real_dist() → list[float][source]

Return the normalized amplitude distribution as a list of floats.

make_qram() → None[source]

Create a QRAM circuit sized for the tree data.

make_tree() → None[source]

Build the binary tree from the current distribution.

random_distribution() → None[source]

Generate a random amplitude distribution.

run() → None[source]

Run the full state-preparation pipeline.

set_qram() → None[source]

Load the binary-tree data into the QRAM circuit.

show_distribution() → None[source]

Print the raw values and normalized amplitudes of the distribution.

show_tree() → None[source]

Print the binary tree level by level.

data_range: int[source]
data_size: int[source]
dist: list[int][source]
qram: object | None[source]
qubit_number: int[source]
rational_size: int[source]
tree: list[int][source]
PySparQ.pysparq.algorithms.state_preparation.create_state_preparation_demo() → str[source]

Return a demo script string for state preparation.