SDE/Fokker–Planck 输入模型¶
oracq.algorithms.qode.sde
Linear ODE input model for Fokker–Planck/SDE and a pure-Python classical witness.
The probability density of the one-dimensional Ito SDE dx = a(x) dt + sqrt(2 D(x)) dW
satisfies the Fokker–Planck equation p' = -∂x(a p) + ∂xx(D p). This module performs a
zero-flux finite-volume discretization on a uniform grid, yielding a discrete generator G
with zero column sums; once G becomes a BlockEncoding via an explicit Pauli expansion, a
QODEProblem/LinearODE can be assembled and handed to the existing linear ODE solvers
(LCHS etc.). The dissipativity of the generator is an input-model declaration, not proved
by the language.
- class oracq.algorithms.qode.sde.FokkerPlanckProblem(drift, diffusion, grid)[源代码]¶
基类:
objectZero-flux finite-volume discretization input model of the conservative-form Fokker–Planck operator.
- 参数:
drift -- Drift coefficient a(x); a constant or a pointwise vector.
diffusion -- Diffusion coefficient D(x) >= 0; a constant or a pointwise vector.
grid -- Uniformly increasing grid coordinate sequence.
- drift¶
- diffusion¶
- grid¶
- property size¶
Number of grid points; also the dimension of the discrete generator matrix.
- property width¶
Quantum register bit count for the grid, equal to
log2(size).Raises
ValidationErrorwhen the number of grid points is not a power of two.
- generator_matrix()[源代码]¶
Return the discrete generator G (column-vector convention
p' = G p, zero column sums).- 返回:
A square matrix of grid dimension, as row-nested tuples.
- 返回类型:
tuple[tuple[float, ...], ...]
- generator_encoding()[源代码]¶
BlockEncoding via a small-scale explicit Pauli expansion; no quantum speedup is claimed.
- 返回:
The explicit Pauli-expansion block encoding of the discrete generator G.
- 返回类型:
- qode_problem(initial=None)[源代码]¶
Assemble the QODEProblem for
p' = G p; dissipative is a caller declaration.- 参数:
initial -- Initial state preparation handle; defaults to the uniform distribution state over the grid width, and its width must match the grid.
- 返回:
The quantum ODE problem driven by the generator G, tagged with zero-flux finite-volume evidence.
- 返回类型:
- oracq.algorithms.qode.sde.sde_state_preparation(probabilities, *, implementation='gate', angle_width=8, work_width=0)[源代码]¶
Encode a discrete initial distribution as a StatePreparation with amplitudes
sqrt(p_i).- 参数:
probabilities -- Non-negative discrete probabilities of power-of-two length.
implementation --
"gate"for the ordinary reused-rotation implementation,"qram"for the QRAM angle-table implementation.angle_width -- Angle-table word width of the QRAM implementation.
work_width -- Extra work bit width of the gate implementation.
- 返回:
Preparation handle of the discrete distribution with amplitudes
sqrt(p_i).- 返回类型:
- oracq.algorithms.qode.sde.sde_state_angles(probabilities, *, angle_width=8)[源代码]¶
Angle-table binding data of the QRAM implementation; keys are rotation-tree node addresses.
- 参数:
probabilities -- Non-negative discrete probabilities of power-of-two length; normalized internally.
angle_width -- Quantization bit width of the angle-table words; a positive integer.
- 返回:
Binding data keyed by rotation-tree node address with quantized angle integers as values.
- 返回类型:
dict[int, int]
- oracq.algorithms.qode.sde.matrix_exponential(matrix, time=1.0)[源代码]¶
Pure-Python matrix exponential by scaling-and-squaring plus Taylor; only for small-scale classical witnesses.
- 参数:
matrix -- A nonempty square matrix with finite real entries.
time -- Duration scaling factor; a finite real number.
- 返回:
The matrix exp(matrix*time), as row-nested lists.
- 返回类型:
list[list[float]]
- oracq.algorithms.qode.sde.evolve_distribution(matrix, initial, time, *, steps=None)[源代码]¶
Classical reference evolution; uses the matrix exponential when steps is None, explicit Euler otherwise.
- 参数:
matrix -- Generator square matrix under the convention
p' = matrix * p.initial -- Initial vector of the same dimension as the matrix.
time -- Evolution duration; a non-negative finite real number.
steps -- Explicit Euler step count; when omitted, the solve is a single matrix-exponential call.
- 返回:
The distribution vector evolved to the given time.
- 返回类型:
list[float]
- oracq.algorithms.qode.sde.distribution_moments(points, probabilities, orders=(1, 2))[源代码]¶
Compute the moments
<x^k>from grid coordinates and a probability vector; defaults to(<x>, <x^2>).- 参数:
points -- Grid coordinate sequence, of the same length as the probability vector.
probabilities -- Per-point probability weights; the sum must be positive; normalized internally.
orders -- Moment orders to compute; a tuple of positive integers.
- 返回:
Normalized moments
<x^k>corresponding one-to-one with the orders.- 返回类型:
tuple[float, ...]
- oracq.algorithms.qode.sde.stationary_distribution(problem)[源代码]¶
Exact stationary state of the zero-flux discretization; adjacent-point ratios are
(1+u)/(1-u).- 参数:
problem -- A normalized Fokker–Planck discrete problem; the diffusion coefficients at all faces must be positive.
- 返回:
Discrete stationary probabilities, one per grid point, summing to one.
- 返回类型:
tuple[float, ...]
- oracq.algorithms.qode.sde.boltzmann_distribution(problem)[源代码]¶
Continuous stationary reference
p ∝ exp(∫ a/D dx), differing from the discrete stationary state by O(h^2).- 参数:
problem -- A normalized Fokker–Planck discrete problem; the diffusion coefficients at all faces must be positive.
- 返回:
Continuous stationary reference probabilities, one per grid point, summing to one.
- 返回类型:
tuple[float, ...]