pauli

Approximate target quantum states by fitting fixed Pauli-word rotation sequences with L-BFGS-B optimization.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Preparing an arbitrary target quantum state on a quantum circuit requires choosing a gate sequence and its parameters; this Skill fits the angles of a fixed Pauli-word rotation ansatz so the emitted circuit reproduces a given target state vector within a requested error tolerance. ## Core Features & Use Cases - Variational State Preparation: Fits one rotation angle per Pauli word using deterministic multi-start L-BFGS-B optimization of the infidelity objective with parameter-shift gradients. - Circuit Emission and Validation: Emits the flattened Pauli-rotation circuit, extracts the prepared state from its dense matrix, and reports a global-phase-invariant L2 error with an ok/failed status. - Debugging and Reimplementation Guidance: Documents the exact ansatz ordering, optimizer settings, return contract, and a minimal manual implementation decomposing rotations into H, P, CX, RZ, and S gates. - Use Case: Given a one-qubit target state like [1, 1j]/sqrt(2), run PauliAlgorithm to obtain fitted weights, the prepared state, and a total error below 1e-6 for use in downstream quantum algorithm workflows. ## Quick Start Ask the assistant to run the Pauli state-preparation algorithm on a normalized one-qubit target vector with target_qubits=1 and target_error=1e-6, then report the status, fitted weights, and total error.

Frequently Asked Questions about pauli

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

FAQPage Schema
How do I prepare an arbitrary quantum state with Pauli rotations in Python?▼

Call PauliAlgorithm().run with your target vector Psi, target_qubits, and target_error. The algorithm fits one angle per Pauli word via L-BFGS-B optimization of infidelity and returns the prepared state, weights, circuit, and a phase-invariant total error.

What is the Pauli-word ansatz used for state preparation?▼

It is a fixed ordered sequence of Pauli words generated recursively, matching PennyLane's ArbitraryStatePreparation. Each word P contributes a rotation exp(-i*theta*P/2), and the ordered product of these rotations maps |0...0> to the target state.

Why does the Pauli state preparation return status failed?▼

A failed status means the best candidate's phase-invariant L2 error exceeded max(target_error, 1e-10), which can happen when the fixed ansatz lacks expressibility or the optimizer does not converge. It is a normal numerical outcome, not an exception.

What dependencies does the Pauli state preparation algorithm require?▼

It requires numpy, scipy, and the UnitaryLab library, specifically state_preparation_pauli_words, pauli_string_to_matrix, and pauli_state_preparation_circuit from unitarylab.library.pauli_operator. Missing helpers cause import failure before execution.

What are the limitations of variational Pauli-word state preparation?▼

The method uses dense matrices, so memory and compute grow exponentially with qubit count, limiting practical use to small registers. Convergence is not guaranteed for every target, and infidelity, candidate-selection error, and final total error are distinct quantities.