Skip to content

Reference: Uniform State Preparation (USP) Qubricks

Contents


USP Class

psiqworkbench.qubricks.qbk_usp.USP

USP(**kwargs)

Bases: Qubrick

Qubrick for Uniform State Preparation.

Follows the construction described in Fig.12 in "Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity" (arXiv:1805.03662 ⧉).

compute

compute(d: int, target_qreg: Qubits | None = None, error_param: float = 0)

Prepare a uniformly distributed state.

Parameters:

Name Type Description Default
d int

Desired number of basis states in the superposition.

required
target_qreg Qubits or None

The register to operate on, or None to allocate a new register.

None
error_param float

A parameter to control the precision of the rotation angle in reflect. Defaults to 0 (no error).

0

Raises:

Type Description
RuntimeError

If the register passed in is too small.

Note

For more details, see Built-in Qubricks tutorial.


ZAUSP Class

psiqworkbench.qubricks.qbk_usp.ZAUSP

ZAUSP(**kwargs)

Bases: Qubrick

Qubrick for Uniform State Preparation.

The routine which uses zero auxiliary qubits from "An efficient quantum algorithm for preparation of uniform quantum superposition states" (arxiv:2306.11747 ⧉).

compute

compute(d: int, target_qreg: Qubits | None = None, error_param: float = 0)

Prepare a uniformly distributed state.

Parameters:

Name Type Description Default
d int

Desired number of basis states in the superposition.

required
target_qreg Qubits or None

The register to operate on, or None to allocate a new register.

None
error_param float

A parameter to control the precision of individual rotations. Defaults to 0 (no error).

0

Raises:

Type Description
RuntimeError

If the register passed in is too small.

Note

For more details, see Built-in Qubricks tutorial.


IUSP Class

psiqworkbench.qubricks.qbk_usp.IUSP

IUSP(**kwargs)

Bases: Qubrick

Qubrick for improved Uniform State Preparation.

compute

compute(d: int, target_qreg: Qubits | None = None, error_param: float = 0)

Prepare a uniformly distributed state.

Parameters:

Name Type Description Default
d int

Desired number of basis states in the superposition.

required
target_qreg Qubits or None

The register to operate on, or None to allocate a new register.

None
error_param float

A parameter to control the precision of individual rotations. Defaults to 0 (no error).

0

Raises:

Type Description
RuntimeError

If the register passed in is too small.

Note

error_param is currently used for quantifying error budget per rotation, but this could change.


USP_RUS Class

psiqworkbench.qubricks.qbk_usp.USP_RUS

USP_RUS(use_jump_control: bool = False, max_num_loops: int = 100, **kwargs)

Bases: Qubrick

Qubrick for Uniform State Preparation, repeat-until-success variant.

This qubrick currently requires the >>jump-control>> filter to exist in your pipeline.

Note

This version of USP is not deterministically reversible and thus cannot be used in settings where we need this reversibility, for example, in PREP of LCU's.

Parameters:

Name Type Description Default
use_jump_control bool

Use (currently experimental) jump opcodes

False
max_num_loops int

The maximum number of loops to try before failing. Note that USP_RUS always has a success rate greater than 50%; the chance of it requiring 100 attempts is vanishingly small.

100

compute

compute(d: int, target_qreg: Qubits | None = None, **kwargs)

Prepare a uniformly distributed state.

Parameters:

Name Type Description Default
d int

Desired number of basis states in the superposition.

required
target_qreg Qubits or None

The register to operate on, or None to allocate a new register.

None

Raises:

Type Description
RuntimeError

If the register passed in is too small.