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)[源代码]

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

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

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

get_fidelity() → float[源代码]

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

get_real_dist() → list[float][源代码]

Return the normalized amplitude distribution as a list of floats.

make_qram() → None[源代码]

Create a QRAM circuit sized for the tree data.

make_tree() → None[源代码]

Build the binary tree from the current distribution.

random_distribution() → None[源代码]

Generate a random amplitude distribution.

run() → None[源代码]

Run the full state-preparation pipeline.

set_qram() → None[源代码]

Load the binary-tree data into the QRAM circuit.

show_distribution() → None[源代码]

Print the raw values and normalized amplitudes of the distribution.

show_tree() → None[源代码]

Print the binary tree level by level.

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

Return a demo script string for state preparation.