Skip to content

State preparation

Build a circuit that prepares a given state vector from |0...0>: exactly, with the magnitude tree and phase diagonal of Mottonen et al. (quant-ph/0407010v1), or approximately, with the layered MPS disentangling circuit of Ran (arXiv:1908.07958v2) after a TT-SVD compression (Oseledets, doi:10.1137/090752286). Import the functions from nwqlib.subroutines.state_preparation. Inside a Program, select_preparation chooses the preparation of a state input.

import numpy as np
from nwqlib.subroutines.state_preparation import (
    analyze_mps_state_compression,
    build_qiskit_state_preparation,
    decompose_state_to_mps,
)

w = np.zeros(8)
w[[1, 2, 4]] = 1  # W state on 3 qubits, unnormalized
exact = build_qiskit_state_preparation(w)
print(round(exact.input_norm**2, 10), exact.preparation_l2_error)
cores = decompose_state_to_mps(w, max_bond_dim=1)
estimate = analyze_mps_state_compression(cores)
print(cores.bond_dimensions, round(estimate.estimated_normalized_fidelity, 10))
3.0 0.0
(1, 1, 1, 1) 0.3333333333

The input has squared norm 3, and the direct circuit prepares the normalized W state exactly. Capping the bond dimension at 1 discards a total squared singular-value weight of 2/3, so the estimated fidelity of the truncated tensor is 1 - 2/3 = 1/3.

Exact preparation

Direct state-preparation helpers.

Exact basis, full-uniform, and supported prefix-uniform states use exact fast paths. General vectors use conditional magnitude rotations and a phase diagonal without synthesis cutoffs.

The general path follows Mottonen et al., quant-ph/0407010v1, Sec. III. It applies a binary tree of uniformly controlled RY rotations with the angles of their Eq. (8) and then the phases. The paper interleaves phase-equalizing RZ multiplexors (Eqs. (4) and (5)) with the RY levels and cancels one CX per level, which reaches 2**(n+1) - 2n - 2 CX when one end is a basis state (half of the general 2**(n+2) - 4n - 4 stated on p. 4). Here all phases form one diagonal after the magnitude tree. Tree and diagonal cost 2**n - 2 CX each, 2 * (2**n - 2) in total for a complex state, and a nonnegative vector, such as an LCU coefficient state, omits the diagonal entirely.

DirectStatePreparation

DirectStatePreparation(*, circuit: QuantumCircuit, normalized_state: ndarray, input_norm: float, num_qubits: int, preparation_l2_error: float = 0.0, method: str = 'qiskit_state_preparation')

A circuit that prepares a normalized state vector exactly, with the input norm.

build_qiskit_state_preparation returns it. The circuit is circuit. The fields below are read-only.

Attributes:

  • circuit (QuantumCircuit) –

    Circuit that prepares normalized_state from |0...0>.

  • normalized_state (ndarray) –

    Normalized target-state amplitudes.

  • input_norm (float) –

    2-norm of the original input vector.

  • preparation_l2_error (float) –

    Phase-sensitive construction error in the ideal-gate model. Zero means no algorithmic approximation. Floating-point synthesis and execution roundoff are not measured by circuit construction.

  • num_qubits (int) –

    Number of qubits in the prepared register.

  • method (str) –

    Name of the construction, "qiskit_state_preparation".

to_dict

to_dict() -> dict[str, Any]

Return a JSON-like preparation summary.

build_qiskit_state_preparation

build_qiskit_state_preparation(vector: Any) -> DirectStatePreparation

Build a circuit that prepares a state vector exactly from |0...0>.

Basis states, uniform states and uniform prefixes use exact fast paths. General vectors use a binary magnitude tree and a phase diagonal. Pairwise hypot reductions avoid squared-magnitude underflow. The construction uses O(n * 2**n) classical arithmetic and O(2**n) live numerical storage, without a target unitary or state simulation.

Parameters:

  • vector (array_like) –

    Complex state amplitudes of power-of-two length. The input may be unnormalized. The returned record keeps its norm, so algorithms can rescale scientific outputs after quantum-state normalization.

Returns:

  • preparation ( DirectStatePreparation ) –

    The circuit in preparation.circuit and the input norm in preparation.input_norm.

Examples:

[3, 0, 0, 4j] has norm 5, and the circuit prepares [0.6, 0, 0, 0.8j]:

>>> import numpy as np
>>> from qiskit.quantum_info import Statevector
>>> from nwqlib.subroutines.state_preparation import (
...     build_qiskit_state_preparation)
>>> preparation = build_qiskit_state_preparation([3, 0, 0, 4j])
>>> print(preparation.input_norm, preparation.num_qubits)
5.0 2
>>> state = Statevector(preparation.circuit).data
>>> print(np.allclose(state, [0.6, 0, 0, 0.8j]))
True

MPS compression

NumPy TT-SVD of a state vector into MPS cores, and scalar analysis of those cores.

The decomposition follows Algorithm 1 (TT-SVD, p. 2301) of Oseledets, "Tensor-train decomposition", SIAM J. Sci. Comput. 33(5), 2295-2317 (2011), doi:10.1137/090752286, with the per-value truncation rule stated in decompose_state_to_mps. The truncation estimates of analyze_mps_state_compression rest on the orthogonality step in the proof of Theorem 2.2 (p. 2299). The work and byte limits are checked for the whole sweep before the first SVD. layered_construction_size bounds the work and bytes of the layered circuit that mps_circuit builds from these cores.

MPSDecomposition

MPSDecomposition(*, cores: tuple[ndarray, ...], num_qubits: int, original_dimension: int, bond_dimensions: tuple[int, ...], max_bond_dim: int | None, threshold: float, discarded_weight: float, input_id: str, input_norm: float = 1.0, provenance: str = 'Oseledets (2011), doi:10.1137/090752286, Algorithm 1 and Theorem 2.2 proof')

The tensor-train (MPS) cores of one normalized state vector, most significant qubit first.

decompose_state_to_mps returns it. discarded_weight is the sum of squared singular values discarded in the sweep. Floating-point truncation metrics are estimates, not bounds on SVD roundoff or fidelity of a synthesized layered circuit. Construction checks that there are max(1, n) cores of shape (r_i, 2, 1, r_{i+1}) with boundary ranks one, finite and read-only, that discarded_weight lies in [0, 1] and that input_norm is positive. The fields below are read-only.

Attributes:

  • cores (tuple[ndarray, ...]) –

    Immutable MSB-first TT cores with shape (left rank, physical size, 1, right rank).

  • num_qubits (int) –

    Number of binary physical sites; zero represents a scalar input.

  • original_dimension (int) –

    Input length, exactly 2**num_qubits.

  • bond_dimensions (tuple[int, ...]) –

    Boundary and internal TT ranks; the first and last equal one.

  • max_bond_dim (int | None) –

    Requested retained-rank cap, or None for no explicit rank cap.

  • threshold (float) –

    Individual singular-value truncation threshold, not a total error tolerance.

  • discarded_weight (float) –

    Sum of discarded squared singular values for the normalized TT-SVD input.

  • input_id (str) –

    Content hash of the normalized input that was compressed.

  • input_norm (float) –

    Positive norm removed from the original input before TT-SVD.

  • provenance (str) –

    How the cores were computed and ordered, with the source of the algorithm.

core_bytes

core_bytes

Total bytes of the stored core arrays.

to_statevector

to_statevector(*, max_bytes=DEFAULT_INPUT_BYTES, max_products=1000000000)

Contract the stored cores into the raw compressed vector, without renormalizing it or computing an SVD.

The vector approximates the normalized input. It is not rescaled by input_norm.

Parameters:

  • max_bytes (int, default: DEFAULT_INPUT_BYTES ) –

    Default 10 GB (decimal, 10_000_000_000 bytes). Limit on the stored cores plus the known arrays of each contraction step and of the output vector, checked before each step. It does not measure process memory.

  • max_products (int, default: 1000000000 ) –

    Default 1_000_000_000. Limit on the scalar multiplications of the whole contraction, the sum over steps of the step's output entries times the contracted bond rank, checked before each step.

Returns:

  • vector ( ndarray ) –

    The original_dimension = 2**num_qubits amplitudes, in the order of the compressed input.

Raises:

  • ValueError –

    If a contraction step or the output would exceed max_bytes or max_products, or if either limit is not a positive integer.

to_dict

to_dict()

Scalar metadata only; no expansion, reference computation or copying cores.

MPSCompressionAnalysis

MPSCompressionAnalysis(*, decomposition: MPSDecomposition, estimated_raw_l2: float, estimated_norm_squared: float, estimated_normalized_fidelity: float | None, reference_id: str | None = None, reference_matches_input: bool | None = None, reference_norm: float | None = None, measured_raw_l2: float | None = None, measured_normalized_fidelity: float | None = None, raw_measured_fidelity: float | None = None, fidelity_roundoff_window: float | None = None, method: str = 'mps_ttsvd_analysis')

Truncation estimates of an MPS decomposition, and an optional comparison with a reference vector.

analyze_mps_state_compression returns it. The estimates follow from the discarded weight alone. The reference_*, measured_*, raw_measured_fidelity and fidelity_roundoff_window fields are filled only when a reference was supplied. The fields below are read-only.

Attributes:

  • decomposition (MPSDecomposition) –

    The analyzed decomposition, shared, not copied.

  • estimated_raw_l2 (float) –

    Floating estimate sqrt(discarded_weight) under the TT-SVD exact-arithmetic relation.

  • estimated_norm_squared (float) –

    Floating estimate 1-discarded_weight for the raw compressed tensor.

  • estimated_normalized_fidelity (float | None) –

    Estimated normalized fidelity from that relation, or None for an undefined zero tensor.

  • reference_id (str | None) –

    Content hash of the supplied comparison reference after normalization, or None without one.

  • reference_matches_input (bool | None) –

    Whether that hash matches the compressed input, or None without a reference.

  • reference_norm (float | None) –

    Norm of the supplied reference before normalization; None without one.

  • measured_raw_l2 (float | None) –

    Explicitly measured raw-tensor distance to the normalized reference, or None if not computed.

  • measured_normalized_fidelity (float | None) –

    Measured normalized fidelity to the supplied reference, clipped to [0, 1], or None if unavailable.

  • raw_measured_fidelity (float | None) –

    Computed |<t,r>|**2 / (<t,t> <r,r>) for the normalized reference t and the raw tensor r before clipping to [0, 1], or None if unmeasured.

  • fidelity_roundoff_window (float | None) –

    Bound on how far rounding can push that value above one, from NWQLib's rounding analysis of this evaluation (see the constants registry). None if unmeasured. It is never an approximation allowance.

  • method (str) –

    Name of the analysis, "mps_ttsvd_analysis".

to_dict

to_dict()

Return a JSON-like record of the analysis, with the decomposition's scalar metadata.

decompose_state_to_mps

decompose_state_to_mps(vector, *, max_bond_dim=None, threshold=1e-14, max_bytes=DEFAULT_INPUT_BYTES, max_svd_work=DEFAULT_MAX_SVD_WORK)

Normalize a state vector and compute its tensor-train (MPS) cores by TT-SVD, without reconstructing the state.

Each site follows steps 4 to 7 of Oseledets (2011), doi:10.1137/090752286, Algorithm 1 (p. 2301): reshape the remaining tensor into a (left_rank*2, right_size) matrix, take its truncated SVD, keep the left singular vectors U as the core and carry S Vh to the next site. The truncation rule differs from the paper. Step 5 keeps the delta-rank, the smallest rank whose discarded tail has Frobenius norm at most delta = eps ||A||_F / sqrt(d - 1) for a prescribed relative accuracy eps and d tensor modes, here the qubit count. This function instead drops every singular value at or below threshold individually, keeps at least one, and then caps the rank at max_bond_dim. NumPy C-order makes the cores MSB-first in the original flattened ordering. The whole economy-SVD work of the sweep, including factors computed before truncation, is checked before the first SVD.

Parameters:

  • vector (array_like) –

    Nonzero state amplitudes of power-of-two length. The input is normalized first.

  • max_bond_dim (int | None, default: None ) –

    Default None (no cap). Largest kept rank at each bond.

  • threshold (float, default: 1e-14 ) –

    Default 1e-14. Singular values at or below it are dropped individually. It is not a total error tolerance.

  • max_bytes (int, default: DEFAULT_INPUT_BYTES ) –

    Default 10 GB (decimal, 10_000_000_000 bytes). Limit on the known arrays. It does not measure process memory.

  • max_svd_work (int, default: DEFAULT_MAX_SVD_WORK ) –

    Default 100_000_000. Limit on the declared dense-SVD work of the whole sweep, the sum of rows times columns times the smaller dimension over all economy SVDs.

Returns:

  • decomposition ( MPSDecomposition ) –

    The cores, bond dimensions and discarded_weight.

analyze_mps_state_compression

analyze_mps_state_compression(decomposition, *, reference=None, max_bytes=DEFAULT_INPUT_BYTES, max_products=1000000000)

Estimate the truncation error of MPS cores, and compare them with a reference vector on request.

The estimates use only the stored discarded weight D: raw L2 distance sqrt(D), raw norm squared 1 - D and normalized fidelity 1 - D, from the orthogonality step in the proof of Oseledets (2011), doi:10.1137/090752286, Theorem 2.2 (p. 2299). They are floating-point estimates, not measured circuit fidelity or certificates. No SVD or contraction runs unless reference is given, which requests one contraction of the cores and a numerical comparison.

Parameters:

  • decomposition (MPSDecomposition) –

    Cores from decompose_state_to_mps.

  • reference (array_like | None, default: None ) –

    Default None. Vector to compare with, normalized first. The result says whether it matches the compressed input.

  • max_bytes (int, default: DEFAULT_INPUT_BYTES ) –

    Default 10 GB (decimal, 10_000_000_000 bytes). Limit on the arrays of the comparison.

  • max_products (int, default: 1000000000 ) –

    Default 1_000_000_000. Limit on the scalar products of the contraction.

Returns:

  • analysis ( MPSCompressionAnalysis ) –

    The estimates, and the measured comparison when a reference was given.

Layered MPS circuits

Circuit-level MPS state preparation via layered disentangling.

This backend constructs a Qiskit circuit without calling Qiskit's dense StatePreparation synthesis. The NumPy TT-SVD and its compression analysis are decompose_state_to_mps and analyze_mps_state_compression.

The layered disentangling scheme implemented here (truncate to bond dimension 2, extract a layer of local unitaries, repeat on the residual state) follows Ran, arXiv:1908.07958v2, Sec. III, steps 1-4, and that paper's Eqs. (6)-(9) complete each truncated tensor to a local unitary.

MPSCircuitStatePreparation

MPSCircuitStatePreparation(*, circuit: QuantumCircuit, decomposition: MPSDecomposition, target_state: ndarray, prepared_state: ndarray | None, input_norm: float, fidelity_to_target: float | None, preparation_l2_error: float | None, num_layers: int, max_bond_dim: int | None, threshold: float, circuit_fidelity_status: str = 'not_evaluated', method: str = 'mps_disentangling_circuit')

A layered MPS state-preparation circuit with its compression data and optional evaluated fidelity.

build_mps_circuit_state_preparation returns it with the fidelity fields unset, and validate_mps_circuit_state_preparation returns a copy with them evaluated. The circuit is circuit. It stores the decomposition and the normalized target used by the validator, and no compression-analysis object or other reconstructed vector. The fields below are read-only.

Attributes:

  • circuit (QuantumCircuit) –

    The layered MPS disentangling state-preparation circuit.

  • decomposition (MPSDecomposition) –

    Compressed target tensor used by circuit construction.

  • target_state (ndarray) –

    Normalized target input in the original flattened basis order.

  • prepared_state (ndarray | None) –

    Explicitly evaluated circuit output, or None when no circuit simulation was requested.

  • input_norm (float) –

    Original input magnitude removed before normalized preparation.

  • fidelity_to_target (float | None) –

    Evaluated circuit fidelity to target, or None if not evaluated.

  • preparation_l2_error (float | None) –

    Evaluated phase-sensitive circuit-to-target distance ||prepared - target||, or None if unavailable.

  • num_layers (int) –

    Number of disentangling circuit layers.

  • max_bond_dim (int | None) –

    Optional requested compression rank cap.

  • threshold (float) –

    Individual singular-value truncation threshold used by compression.

  • circuit_fidelity_status (str) –

    "evaluated" or "not_evaluated" for the circuit fidelity. Compression estimates do not fill it.

  • method (str) –

    Name of the construction, "mps_disentangling_circuit".

to_dict

to_dict() -> dict[str, Any]

Return a JSON-like circuit state-preparation summary.

mps_to_circuit

mps_to_circuit(mps: Any, *, num_layers: int = 1) -> QuantumCircuit

Convert a right-canonical MPS to a Qiskit circuit by disentangling.

At each layer, the MPS is truncated to bond dimension 2. Local one- and two-qubit unitaries are extracted, and their inverses are applied back to the MPS so the next layer works on a less-entangled residual state.

This is Ran (arXiv:1908.07958v2), Sec. III, steps 1-4. Site i of the MSB-first cores acts on qubit n - 1 - i. A site with bonds (1, 2) becomes a two-qubit unitary whose first column is the core (Eq. (9)), a site with bonds (2, 2) fixes the two columns given by its left-bond slices (Eq. (7)), a site with bonds (2, 1) is the one-qubit gate formed from its core (Eq. (6)), and a product site is one one-qubit gate. Each new layer is composed at the front, so the finished circuit applies the last extracted layer first and the first extracted layer last.

Each two-qubit unitary is synthesized exactly to rounding with at most three CX, so the synthesis adds only rounding to the error of the layered construction. Qiskit's TwoQubitBasisDecomposer replaces a unitary by a class with fewer CX whenever the average gate fidelity between them is at least 1 - 1e-9. For states within about 1e-5 of a product state it saved one or two CX per unitary and erred by about the distance from the product state (1e-9 to 1e-5 in tests), and the exact synthesis keeps those CX.

Parameters:

  • mps (TT) –

    Right-canonical tensor train with cores of shape (a, 2, 1, b).

  • num_layers (int, default: 1 ) –

    Default 1. Number of disentangling layers.

Returns:

  • QuantumCircuit –

    QuantumCircuit that approximates the MPS state from |0...0>.

  • QuantumCircuit –

    A finite layer count can leave a residual even when the original

  • QuantumCircuit –

    TT-SVD discarded weight is zero; no circuit error is measured here.

build_mps_circuit_state_preparation

build_mps_circuit_state_preparation(vector: Any, *, max_bond_dim: int | None = None, threshold: float = 1e-14, num_layers: int = 2, register_name: str = 'system', _selected_decomposition: MPSDecomposition | None = None, max_bytes: int = DEFAULT_MAX_BYTES, max_svd_work: int = DEFAULT_MAX_SVD_WORK) -> MPSCircuitStatePreparation

Build a layered MPS circuit that approximately prepares a state vector from |0...0>.

The vector is compressed by one TT-SVD sweep, as in decompose_state_to_mps, and mps_to_circuit builds the layered disentangling circuit (Ran, arXiv:1908.07958v2, Sec. III). The circuit is not simulated, so its fidelity is not evaluated.

Parameters:

  • vector (array_like) –

    State amplitudes to prepare.

  • max_bond_dim (int | None, default: None ) –

    Default None (no cap). TT-SVD maximum bond dimension.

  • threshold (float, default: 1e-14 ) –

    Default 1e-14. Singular-value pruning threshold for the core decomposition.

  • num_layers (int, default: 2 ) –

    Default 2. Number of MPS disentangling layers.

  • register_name (str, default: 'system' ) –

    Default "system". Name for the prepared quantum register.

  • max_bytes (int, default: DEFAULT_MAX_BYTES ) –

    Default 10 GB (decimal, 10_000_000_000 bytes). Limit on the known input and TT-SVD arrays. It does not measure process memory. The layered construction (layered construction law) and the exact syntheses of the two-qubit unitaries are checked against it separately, before either starts.

  • max_svd_work (int, default: DEFAULT_MAX_SVD_WORK ) –

    Default 100_000_000. Limit on the whole-sweep dense-SVD work. The layered construction's scikit_tt sweeps and products and the at most num_layers * (n - 1) exact syntheses of two-qubit unitaries are checked against it separately, before either starts.

Returns:

  • preparation ( MPSCircuitStatePreparation ) –

    The circuit with its compression data, and unevaluated circuit diagnostics. The TT-SVD discarded weight describes core compression, not the finite-layer circuit error.

Examples:

The 3-qubit GHZ state has bond dimension 2, and the validated circuit prepares it with fidelity 1. The layered construction needs scikit_tt, which is installed separately from NWQLib's extras:

>>> import numpy as np
>>> from nwqlib.subroutines.state_preparation import (
...     build_mps_circuit_state_preparation,
...     validate_mps_circuit_state_preparation)
>>> ghz = np.zeros(8)
>>> ghz[[0, 7]] = 1
>>> preparation = build_mps_circuit_state_preparation(ghz)
>>> print(preparation.decomposition.bond_dimensions)
(1, 2, 2, 1)
>>> checked = validate_mps_circuit_state_preparation(preparation)
>>> print(round(checked.fidelity_to_target, 10))
1.0

validate_mps_circuit_state_preparation

validate_mps_circuit_state_preparation(preparation: MPSCircuitStatePreparation) -> MPSCircuitStatePreparation

Simulate a built MPS circuit once and return a copy with its fidelity to the target.

This helper performs one statevector simulation, whose cost grows exponentially with the qubit count, for small-instance validation. It compares the circuit output with the stored normalized target and returns a copy of preparation with prepared_state, fidelity_to_target, the phase-sensitive preparation_l2_error and circuit_fidelity_status="evaluated".

Parameters:

Returns:

Accuracy, cost and limits

Exact preparation:

  • Basis states, full-uniform states and prefix-uniform states take exact fast paths. General vectors use a binary tree of conditional RY rotations followed by a phase diagonal. Pairwise hypot norms and atan2 angles avoid squared-magnitude underflow, and the Walsh and Gray-code synthesis skips exact zero angles. No synthesis cutoff discards a requested small rotation.
  • For an n-qubit generic vector, each magnitude tree or phase diagonal uses at most max(0, 2**n - 2) CX gates. General complex preparation uses both, and positive LCU coefficient preparation needs the magnitude tree only. Mottonen et al. interleave the phase multiplexors with the magnitude levels and cancel one CX per multiplexor, two per level, reaching 2**(n+1) - 2n - 2 CX from a basis state. The separate diagonal used here costs 2n - 2 more CX for a complex state and lets a nonnegative vector omit the phase stage.
  • preparation_l2_error = 0 describes the ideal-gate construction with no algorithmic approximation. It is not a measured bound on floating-point synthesis, backend execution or hardware error. The direct preparation record reports fidelity_to_target = None in to_dict() because ordinary construction does not evaluate fidelity. Binary64 roundoff can limit relative accuracy for components near or below machine precision, especially when a tiny component results from cancellation among rotations.

MPS compression and layered circuits:

  • build_mps_circuit_state_preparation runs one TT-SVD sweep, or reuses a matching decomposition that NWQLib's planning passes to it. The core metadata includes the ranks, the content hash of the normalized input and the discarded singular-value weight. The full input and the economy SVDs still have their dimension-dependent storage and computation costs.
  • The layered-construction check of build_mps_circuit_state_preparation uses layered_construction_size, which follows the sweeps that scikit_tt repeats after every extracted gate. Contraction of the cores has its separate scalar-product and byte limits.
  • The one-qubit gates of the MPS circuit include their global phase, so controlled preparations keep the relative phase as well as the state populations.
  • The DEFAULT_MAX_SVD_WORK paragraph of the constants registry gives the default of 100,000,000 and the measurements behind the cost formula of the layered construction, and its layered MPS construction law gives the formula.

Source map

Code paths are relative to nwqlib.subroutines. Equation and section numbers refer to the listed arXiv or journal versions.

Scientific step Source Location Code
Magnitude-tree RY angles Mottonen et al., quant-ph/0407010v1 Sec. III, Eq. (8) state_preparation.direct._build_normalized_state_preparation
Uniformly controlled RY and RZ lowering by Walsh transform and Gray code Mottonen et al., quant-ph/0407010v1, and Shende, Bullock and Markov, quant-ph/0406176v5 Sec. II, Fig. 2 and Eq. (3), and Theorem 8 _multiplexors._rotation_multiplexor
Phase diagonal as one RZ multiplexor per qubit Shende, Bullock and Markov, quant-ph/0406176v5 Theorem 7 _multiplexors.append_control_diagonal_phases
CX counts 2**k per multiplexor and 2**n - 2 per tree or diagonal Shende, Bullock and Markov, quant-ph/0406176v5, summed over the tree by NWQLib Theorem 8 and Fig. 2 _multiplexors.multiplexor_resource_law
TT-SVD sweep and truncation estimates Oseledets, SIAM J. Sci. Comput. 33(5) (2011), doi:10.1137/090752286 Algorithm 1 (p. 2301) for the sweep. Proof of Theorem 2.2 and Eq. (2.5) (p. 2299) for the error estimate, with NWQLib's inner-product step for the norm and fidelity estimates state_preparation.mps.decompose_state_to_mps, state_preparation.mps.analyze_mps_state_compression
Layered disentangling circuit Ran, arXiv:1908.07958v2 Sec. III steps 1-4, Eqs. (6)-(9) state_preparation.mps_circuit.mps_to_circuit

Entries on other pages

select_preparation is documented on Extending NWQLib.