state-preparation

Routes quantum state-loading requests among five UnitaryLab state-preparation algorithm implementations.

18|3|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/unitarylab/quantum-practices --skill state-preparation-unitarylab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-preparation
Source: https://github.com/unitarylab/quantum-practices/tree/main/algorithms/state-preparation
Command: npx skills add https://github.com/unitarylab/quantum-practices --skill state-preparation-unitarylab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, scipy, and includes scripts (resource) components.

What problem does it solve? Choosing the right quantum state-preparation method is difficult because sparse-support, MPS, multiplexer, Möttönen, and variational Pauli-word approaches each exploit different target structures, work-qubit budgets, and error trade-offs. This Skill acts as a router that selects and compares the correct UnitaryLab leaf algorithm for loading a target amplitude vector into a quantum circuit. ## Core Features & Use Cases - Method Routing: Applies ordered routing rules that honor explicit method requests, recognize supplied MPS tensors, compare structural candidates, and default to Möttönen for general complex targets. - Five Leaf Algorithms: Covers sparse Superposition, Möttönen uniformly controlled rotations, Matrix Product State preparation, recursive Multiplexer preparation, and variational Pauli-word preparation. - Shared Validation Contract: Enforces common rules for normalization, trailing-zero padding, target_qubits >= 1, phase-invariant error comparison, and distinct per-method error metrics. - Use Case: A user supplies a low-entanglement target vector and asks which preparation method fits; the Skill compares MPS against Möttönen using bond dimension, work qubits, and allowed error before generating code from the selected leaf. ## Quick Start Ask the assistant to prepare a given complex amplitude vector on a specified number of qubits and let it select the appropriate UnitaryLab state-preparation method.

Frequently Asked Questions about state-preparation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose a quantum state-preparation method for a target vector?

State-preparation method selection depends on target structure: explicit method requests are honored first, supplied MPS tensors route to MPS preparation, sparse computational-basis support routes to Superposition, and a general complex target with no special structure defaults to Möttönen. Work-qubit budget, exactness requirements, and whether variational optimization is acceptable also decide between candidates.

What is the difference between Möttönen and multiplexer state preparation?

Möttönen uses uniformly controlled RY/RZ ladders with a reflected Gray-code schedule, while multiplexer preparation builds a recursive binary probability tree with RY/CRY/MCRY gates plus basis-selective phase loading. They are not interchangeable merely because both use controlled rotations; each has its own gate schedule and wire-order contract.

When should I use MPS state preparation instead of Möttönen?

MPS preparation fits when the target has low-entanglement structure or supplied MPS tensors with a known bond dimension, since it can reduce preparation cost using work qubits. Low entanglement alone is not a guarantee; compare actual bond dimension, work-wire availability, and allowed truncation error against the deterministic Möttönen route.

Does Pauli-word state preparation guarantee exact state loading?

No, Pauli-word preparation is a variational method that fits a fixed ansatz by optimizing infidelity with deterministic L-BFGS-B restarts. A valid run can return status "failed" when the ansatz or optimizer does not reach the target error, so it is not the default exact deterministic route.

Why does state preparation fail with target_qubits set to zero?

Although result validators may accept zero, the current UnitaryLab Circuit(0) constructor rejects zero qubits, so the supported public contract requires target_qubits >= 1. The target vector must also be non-empty, finite, nonzero in norm, and no longer than 2**target_qubits.

How is state-preparation error validated across different methods?

Each method reports distinct metrics: Möttönen and Multiplexer report phase-invariant state error, MPS separates zero-work projection error, work leakage, and bond truncation, and Pauli optimizes infidelity but reports phase-aligned L2 error. Global-phase comparison uses only a unit-modulus alignment factor from the state overlap.