Carleman linearization¶
oracq.algorithms.qnlss.carleman
Finite-order tensor lifting of polynomial ODEs, initial states, and physical channel selection.
- class oracq.algorithms.qnlss.carleman.PolynomialODE(width, coefficients, initial, initial_norm=1.0)[source]¶
Bases:
objectPolynomial ODE input model and the input declarations needed for Carleman assembly.
- Variables:
width (int) – Width d of a single-level state vector (register bits).
coefficients (tuple[tuple[int, oracq.algorithms.input_model.operators.BlockEncoding], ...]) – Sequence of (degree p, block encoding F_p) pairs; degrees are distinct and the sequence is nonempty; F_p acts on the d^p-dimensional tensor power, with width
max(1, p) * width.initial (oracq.algorithms.input_model.oracles.StatePreparation) – Preparation of the initial state u(0).
initial_norm (float) – Initial state norm used to weight each tensor level; defaults to 1.0.
- Raises:
ValidationError – Raised at construction when width/degree/norm values are invalid, the coefficient table is empty or has duplicate degrees, an F_p width mismatches, or the initial-state layout does not match.
- width¶
- coefficients¶
- initial¶
- initial_norm = 1.0¶
- oracq.algorithms.qnlss.carleman.carleman_lift(problem, *, cutoff=2)[source]¶
Assemble the block encoding of the truncated Carleman linear embedding.
Placement terms are enumerated for each target tensor level and polynomial degree and combined by an equal-weight LCU; the output attributes record
cutoffand the padded-row zero assumption (padding rows outside the first d rows and columns outside d^p are zero).- Parameters:
problem – A
PolynomialODEinput model.cutoff – Carleman truncation order; must be positive.
- Returns:
The embedding operator acting on
cutoff * widthdata bits plus the level register.- Return type:
- Raises:
ValidationError – problem is not a
PolynomialODE, or cutoff is invalid.
- oracq.algorithms.qnlss.carleman.carleman_initial(problem, *, cutoff=2)[source]¶
Construct the zero-input preparation of the tensor initial state.
The level register is prepared weighted by powers of
initial_norm, then the initial state is copied into the first k levels under control, forming the tensor power vector of u(0).- Parameters:
problem – A
PolynomialODEinput model.cutoff – Carleman truncation order; must be positive.
- Returns:
Target is
cutoff * widthdata bits plus the level register; the work space is reused per level at the width ofinitial.- Return type:
- Raises:
ValidationError – problem is not a
PolynomialODE, or cutoff is invalid.
- oracq.algorithms.qnlss.carleman.carleman_qode(problem, time, linear_solver, *, cutoff=2)[source]¶
Hand the Carleman embedding to a linear solver and project back to the first level.
It first assembles
carleman_liftandcarleman_initial, then evolves to timetimevialinear_solver, and finally selects the first tensor level as the solution state; the effect of the truncated tail terms is recorded as pending undertruncation_assumption.- Parameters:
problem – A
PolynomialODEinput model.time – Target evolution time; non-negative.
linear_solver – A callable linear solver of the form
(generator, initial, time) -> StateOracle.cutoff – Carleman truncation order; must be positive.
- Returns:
The first-level solution state of width
problem.width.- Return type:
- Raises:
ValidationError – Input types or values are invalid,
linear_solveris not callable, or its output is not aStateOracle.