Skip to content

workbench_algorithms.subroutines.lks_state_prep

Functions for Low-Kliuchnikov-Schaeffer state preparation.

LKSMultiplexor

LKSMultiplexor(qrom, gate, **kwargs)

Bases: Qubrick

Multiplexor using data-lookup oracles.

The construction is detailed in arXiv:1812.00954 . Circuit described in Appendix D.

Parameters:

Name Type Description Default
qrom Qubrick

Data-loader for loading angles to bits_of_precision-bits of precision.

required
gate op

Rotation gate type to use in multiplexed rotations.

required
**kwargs dict[str, Any]

Other arguments to pass to the init.

{}

compute

compute(
    index_reg,
    tgt,
    angles,
    bits_of_precision,
    lambda_val=None,
    **kwargs,
) -> None

Compute circuit for LKS multiplexor.

Parameters:

Name Type Description Default
index_reg Qubits

Index register.

required
tgt Qubits

Register to apply rotations onto.

required
angles list or None

List of angles to supply to rotations.

required
bits_of_precision int

Bits of precision for rotations.

required
lambda_val int

Power-of-two knob to trade off between gates and qubits. If None (default), then optimal lambda is calculated. If None (default), the clean decomposition will be used.

None
**kwargs dict[str, Any]

Other arguments to pass to the compute.

{}
Note

We want to apply single-qubit \(\text{RY}\) rotations conditioned on different significant bits. We truncate the exact angle and obtain an integer approximation of it, and so, each angle we apply is \(\frac{2\pi a_k} {2^{k + 1}}\). However, we express \(\text{RY}\) rotations as \(\text{RY}(\theta) = e^{iY \frac{\theta}{2}}\). If you account for this factor of 2 in the denominator, and also convert from radians to degrees \((\frac{180}{\pi})\), you end up using:

  • \(\text{angle} = \frac{\frac{2\pi a_k}{2^{k + 1}}}{2} \times \frac{180}{\pi}\)
  • Simplified: \(\text{angle} = \frac{180 a_k}{2^{k + 1}}\)

LKSStatePrep

LKSStatePrep(coeffs, mplxr, **kwargs)

Bases: Qubrick

State preparation detailed in arXiv:1812.00954 .

This routine works for real, positive coefficients.

Parameters:

Name Type Description Default
coeffs list or None

List of coefficients to load into state.

required
mplxr Qubrick

Multiplexor to use in state prep.

required
**kwargs dict[str, Any]

Other arguments to pass to the init.

{}

compute

compute(qbits, **mplxr_kwargs) -> None

Compute circuit for LKS state prep.

Parameters:

Name Type Description Default
qbits Qubits

Qubits to prep state on.

required
**mplxr_kwargs dict

Dictionary with keyword arguments to pass to the multiplexor.

{}

Other Parameters:

Name Type Description
bits_of_precision int

Bits of precision for rotations.

lambda_val int

Power-of-two knob to trade off between gates and qubits. If None, then optimal lambda is calculated. If None, the clean decomposition will be used.