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: object

Polynomial 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 cutoff and the padded-row zero assumption (padding rows outside the first d rows and columns outside d^p are zero).

Parameters:
  • problem – A PolynomialODE input model.

  • cutoff – Carleman truncation order; must be positive.

Returns:

The embedding operator acting on cutoff * width data bits plus the level register.

Return type:

BlockEncoding

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 PolynomialODE input model.

  • cutoff – Carleman truncation order; must be positive.

Returns:

Target is cutoff * width data bits plus the level register; the work space is reused per level at the width of initial.

Return type:

StatePreparation

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_lift and carleman_initial, then evolves to time time via linear_solver, and finally selects the first tensor level as the solution state; the effect of the truncated tail terms is recorded as pending under truncation_assumption.

Parameters:
  • problem – A PolynomialODE input 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:

StateOracle

Raises:

ValidationError – Input types or values are invalid, linear_solver is not callable, or its output is not a StateOracle.