Noise kernel and noise-specialized estimates
The UniformKernelUlam family discretizes additive uniform noise on the Ulam basis. Two boundary policies are exposed: UniformKernelUlamPeriodic (circle) and UniformKernelUlamReflecting (interval with reflecting boundary).
RigorousInvariantMeasures.DiscretizedNoiseKernelUlam — Type
DiscretizedNoiseKernelUlam{T,S}Ulam discretization of a noise kernel whose bounds are of type T, one of the types Interval{T} is built on.
T is a parameter rather than fixed to Float64 because w and z are the scratch buffers the multiplication writes through: they are touched once per output entry, so at the abstract Vector they cost a boxed load every iteration, 2.2 MB per application at k = 16384; and fixed to Vector{Float64} they would silently narrow a Vector{Interval{BigFloat}} argument to double precision, which the error term added afterwards does not account for.
RigorousInvariantMeasures.UniformNoiseUlam — Function
UniformNoiseUlam([T,] ξ, B::Ulam, boundarycondition = :periodic)Ulam discretization of the uniform noise kernel of half-width ξ, with bounds of type T (Float64 by default). Apply it to a Vector{Interval{T}} of the matching type: a vector of a wider type would be narrowed to T on the way into the scratch buffers, and the error term is not written to cover that.
RigorousInvariantMeasures._convolve_reflecting! — Method
Accumulate the reflecting-boundary convolution of the float vector src into dest, which must have length k and is overwritten.
This is definition 8 of Galatolo-Monge-Nisoli read literally: extend src by zero outside 1:k, convolve on ℤ, then push the mass that fell outside back in with the mirror map π of reflect_outward_idx. Every step preserves mass, so the result is Markov whatever the parity of the window.
Reflecting the input instead and reading off 1:k is the adjoint of this, not the same operator; with the even window this kernel builds it is not even mass-preserving, losing O(1/k) of the mass on a density that is not symmetric.
RigorousInvariantMeasures._extend_periodic! — Method
Wrap src periodically into the workspace w, so that w[j] = src[j-l mod k].
RigorousInvariantMeasures.UlamProjectedUniformKernel — Type
UlamProjectedUniformKernel{BC,T} <: NoiseKernelThe operator π N_ξ π on the Ulam partition B of k intervals of width δ = 1/k: N_ξ is the convolution with the uniform density ρ_ξ = ξ⁻¹ 1_{[-ξ/2, ξ/2]} followed by the boundary condition BC (:periodic or :reflecting), and π the Ulam projection. It is the operator π_δ N_ξ π_δ of Galatolo, Monge, Nisoli, Nonlinearity 33 (2020) 4237, §2, for which the two-grid estimate of their Lemma 29 is written; in particular the same ξ can be used on a partition and on any refinement of it.
The flat window UniformKernelUlam is a different operator: for ξ = (2l+1)δ its distance from this one in L¹ is δ/(2ξ), and on a dyadic refinement no flat window represents the same ξ, since 2l′+1 = 2ʲ(2l+1) has no solution.
With s = ξ/δ, the entry of the matrix at offset d = i - j, before the boundary condition, is
w_d = (F(s/2 - d) - F(-s/2 - d)) / s,F the primitive of the unit tent Λ(t) = max(0, 1 - |t|), which is the density of the difference of two independent uniform points of a cell. So w_d = 1/s for |d| ≤ m := ⌊s/2⌋ - 1, the offsets ±(m+1) and ±(m+2) carry c₁/s and c₂/s with c₁, c₂ ∈ [0, 1], and all the others vanish; (2m+1) + 2(c₁ + c₂) = s. For s = 2l+1 the row is (1/8, 7/8, 1, …, 1, 7/8, 1/8)/s.
The product is the flat window of 2m+1 cells, by the block scheme of UniformKernelUlam, plus the two boundary corrections on each side, divided by s. Every entry is then a floating-point sum of 2m+5 nonnegative multiples of the input, each passing through at most P = max(2m+3, 5) roundings, so
|fl((Kv)_i) - (Kv)_i| ≤ γ_P (K|v|)_i ,[Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., §3.1 and (4.3)]; the error is local, and at most γ_P ‖v‖₁ in L¹.
ξ k must be exactly representable in T, and so must c₁ and c₂, which are then exact dyadic numbers when s is; the constructor checks both, so pass ξ as a rational, e.g. (2l+1)//k. The support must cover at least two cells, s ≥ 2.
RigorousInvariantMeasures.UniformKernelUlam — Type
struct UniformKernelUlam{BC,T,S} <: NoiseKernelUlam discretization of the uniform noise kernel with half-width l on a partition B::Ulam. The type parameter BC specifies the boundary condition:
:periodic→ periodic wrap-around:reflecting→ mirror reflection (projection π)
T is the type of the bounds, Float64 by default. The scratch buffers carry it, so applying a kernel to a Vector{Interval{T′}} with T′ wider than T would narrow the midpoints on the way in, which the error term added afterwards does not account for; build the kernel at the type you mean to use.
S is the summation scheme of the window sums, :sliding by default:
:sliding→ one running sum, updated by adding the entering entry and subtracting the leaving one, with Kahan compensation. The error of an entry is that of a compensated sum of every term processed so far, so it is bounded in terms of the whole vector and not of the window.:block→ the block scheme of van Herk (Pattern Recognit. Lett. 13 (1992) 517–521) and Gil and Werman (IEEE TPAMI 15 (1993) 504–507), written there for running maxima and valid for any associative operation. The extended vector is cut into blocks of lengthn = 2l+1, sums are accumulated inside each block from the right and from the left, and every window, which meets at most two blocks, is the sum of one right-accumulated and one left-accumulated partial sum. No entry is subtracted, and each window sum is a floating-point sum of its ownnterms, so the error of an entry is at mostγₙtimes the kernel applied to|v|at that entry. The cost is three additions per entry, as for:sliding.
Fields
B::Ulam: the Ulam partitionl::Int: half-width of the averaging windowscratch_ext::Vector{T}: workspace of lengthk+2lfor building extended vectorscratch_sum::Vector{T}: workspace of lengthkfor storing window sumsscratch_suf::Vector{T}: workspace of lengthk+2lfor the right-accumulated block sums of the:blockscheme (empty for:sliding)
RigorousInvariantMeasures.UniformKernelUlam — Method
UniformKernelUlam(::Val{BC}, [T,] B::Ulam, l::Int; summation = :sliding)Constructor for a UniformKernelUlam{BC,T,S} kernel on the partition B with half-width l, bounds of type T (Float64 by default) and summation scheme S = summation, either :sliding or :block. Allocates the necessary scratch buffers of sizes k+2l and k (k = length(B)).
LinearAlgebra.mul! — Method
mul!(K::UlamProjectedUniformKernel, v::Vector{Interval})With m and r the midpoints and radii of v, the result at entry i is centred at the computed (Km)_i with radius γ_P (K|m|)_i + (Kr)_i; the two sums are of nonnegative terms, computed with relative error at most γ_P, and are divided by 1 - γ_P and combined with upward rounding, as for the :block flat window.
LinearAlgebra.mul! — Method
mul!(K::UniformKernelUlam{BC,T,:block}, v::Vector{Interval{T}})In-place application of the kernel to a vector of intervals with the block scheme. With m and r the midpoints and radii of v, the result at entry i is centred at the computed (Km)_i with radius
γₙ (K|m|)_i + (K r)_i ,the first term the rounding of the centre, the second the propagated radii (K is entrywise nonnegative). Both (K|m|)_i and (Kr)_i are sums of nonnegative terms, which the block scheme computes with relative error at most γₙ, so each is bounded above by its computed value divided by 1 - γₙ; the radius is formed with upward rounding from these. The radius is local to the window, unlike the uniform one of the :sliding scheme.
LinearAlgebra.mul! — Method
mul!(K::UniformKernelUlam{BC,T,:block}, v::Vector{T})In-place application of the kernel with the block scheme. Every entry of the result is a window sum of n = 2l+1 terms, formed with n-1 additions and no subtraction, divided by n; by the bound for summation in any order [Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., (4.3)], together with the final division,
|fl((Kv)_i) - (Kv)_i| ≤ γₙ (K|v|)_i ,so that the error is local and, in any monotone norm, at most γₙ ‖K‖ ‖v‖.
LinearAlgebra.mul! — Method
mul!(K::UniformKernelUlam, v::Vector{Interval})In-place application of the uniform kernel to a vector of intervals. The operation is performed on midpoints with sliding window sums, and then a uniform interval error bound is added to account for radii.
LinearAlgebra.mul! — Method
mul!(K::UniformKernelUlam{BC,T}, v::Vector{T})In-place application of the uniform kernel to a real vector v. Uses a preallocated scratch extension vector and sliding-window sum with Kahan summation for numerical stability.
RigorousInvariantMeasures.UniformKernelUlamPeriodic — Method
UniformKernelUlamPeriodic(B::Ulam, l::Int)Construct a periodic uniform Ulam kernel on the partition B with half-width l (window size = 2l+1).
This operator acts as a stochastic convolution with uniform noise, where indices outside [1,k] wrap around periodically.
RigorousInvariantMeasures.UniformKernelUlamReflecting — Method
UniformKernelUlamReflecting(B::Ulam, l::Int)Construct a reflecting uniform Ulam kernel on the partition B with half-width l (window size = 2l+1).
This operator acts as a stochastic convolution with uniform noise, where indices outside [1,k] are mapped back into [1,k] by the reflecting projection π (period-2 mirror).
RigorousInvariantMeasures._block_window_sums! — Method
_block_window_sums!(sums, ext, suf, k, n)Write into sums[i], for i = 1:k, the floating-point sum of ext[i:i+n-1], computed without subtraction. The extended vector ext (length k+n-1) is cut into blocks 1:n, n+1:2n, …; suf[t] is the sum from t to the end of its block, accumulated from the right. A window starting at a block start is that block, suf[i]; any other window starting in block b ends in block b+1, and is suf[i] plus the sum from the start of block b+1 to the end of the window, accumulated from the left in p. Each window sum therefore uses n-1 additions of its own n terms and nothing else.
RigorousInvariantMeasures._projected_window! — Method
Write fl(K x) into out; out may be x.
RigorousInvariantMeasures._tent_primitive — Method
Primitive of the unit tent Λ(t) = max(0, 1 - |t|), vanishing at -∞.
RigorousInvariantMeasures.dfly — Method
dfly(::Type{TotalVariation}, ::Type{L1}, N::UlamProjectedUniformKernel)Var(π N_ξ π f) ≤ Var(N_ξ π f) ≤ ξ⁻¹ Var(ρ) ‖π f‖₁ ≤ (2/ξ) ‖f‖₁, the projection not increasing the variation and Var(ρ) = 2 for the uniform mother kernel on [-1/2, 1/2] (Galatolo, Monge, Nisoli, Nonlinearity 33 (2020) 4237, Lemma 47); 2/ξ = 2k/s.
RigorousInvariantMeasures.dfly — Method
dfly(::Type{VarInterval}, ::Type{L1}, N::UniformKernelUlam)Return the Doeblin–Fortet–Lasota–Yorke inequality coefficients for the operator acting from L¹ to bounded variation. For the uniform kernel on k bins with half-width l, the effective noise size is ξ = (2l+1)/k, and the inequality is bounded by (0, 1/(2ξ)).
The constant bounds the variation on the circle as well as on the interval, so it may be read in either convention: Var(ρ_ξ) = 1/ξ counts one rise and one fall of the kernel's density, and identifying the endpoints adds no jump to it.
RigorousInvariantMeasures.get_idx — Method
get_idx(::Val{:periodic}, i, k)Return the periodic index corresponding to i in 1:k.
RigorousInvariantMeasures.get_idx — Method
get_idx(::Val{:reflecting}, i, k)Return the reflecting index corresponding to i in 1:k, according to the projection π.
RigorousInvariantMeasures.nonzero_per_row — Method
Number of terms of one entry, 2m+5. Callers take gamma(T, nonzero_per_row(K)) as the relative rounding of an entry, and γ_{2m+5} is at least the γ_P of the type docstring.
RigorousInvariantMeasures.nonzero_per_row — Method
nonzero_per_row(M::UniformKernelUlam)Return the number of nonzeros per row of the transition matrix associated with the discretized uniform noise kernel. This equals the window size 2l+1.
RigorousInvariantMeasures.opnormbound — Method
L¹ operator norm: the matrix is nonnegative with unit row and column sums.
RigorousInvariantMeasures.opnormbound — Method
opnormbound(B::Ulam, ::Type{L1}, M::UniformKernelUlam)Return an upper bound on the operator norm in L¹. For the uniform noise kernel, the L¹ operator norm is exactly 1.
RigorousInvariantMeasures.opradius — Method
The weights are stored exactly, so the matrix has no radius.
RigorousInvariantMeasures.opradius — Method
opradius(::Type{L1}, M::UniformKernelUlam)Return the "radius" term in the L¹ Lasota–Yorke inequality. For the uniform kernel this is zero, but can be extended for interval-aware variants.
RigorousInvariantMeasures.reflect_outward_idx — Method
reflect_outward_idx(i, k)Reflecting index mapping (projection π): maps an index i on ℤ into 1:k by period-2k reflection symmetry.
RigorousInvariantMeasures.wrap_idx — Method
wrap_idx(i, k)Periodic index mapping: wraps i into the range 1:k.
A posteriori noise error estimates
The routines below produce data-dependent error bounds for systems with additive uniform noise, exploiting the actually-computed density vector to obtain tighter bounds than the generic DFLY-based distance_from_invariant_noise.
RigorousInvariantMeasures.PreimageInfo — Type
Information about a single preimage of an interval I under a branch Tₖ.
RigorousInvariantMeasures._mag_or_inf — Method
_mag_or_inf(g, x)An upper bound on |g(x)| for an interval x, or Inf where g cannot be bounded on x: a DomainError or an empty result, as for the derivative of (1/8 - x)^(1/3) at x = 1/8. An infinite bound makes the estimates below fall back to the mass, which is valid whatever the true value.
RigorousInvariantMeasures.estimate_L1_NL_discretization_error — Method
estimate_L1_NL_discretization_error(var_NLf, derivs, δ, varRho)Estimate ||NL(1-π)NLf||₁ — the L1 norm of the second-order discretization error.
For each interval: min(δ*varRho/4*deriv[i], 1) * var_NLf[i], summed and scaled by δ/2.
RigorousInvariantMeasures.estimate_Wnorm_of_discretization_error — Method
estimate_Wnorm_of_discretization_error(prep, density_vec, B_density::Ulam)Estimate ||(1-π)Lf||_W where π is the Ulam projection and f is the density represented by density_vec on the basis B_density.
For each interval I and each preimage, computes two alternative bounds and takes the minimum:
- Variation-based:
(δ/4) * estimate_var - Measure-based:
meas_in_ab
Returns (est, meas_Lf, var_Lf):
est: the W-norm estimate (scalar, rounded up)meas_Lf: vector of measure of Lf per estimation intervalvar_Lf: vector of variation of Lf per estimation interval
RigorousInvariantMeasures.estimate_measure_after_noise — Method
estimate_measure_after_noise(meas_Lf, K::UlamProjectedUniformKernel)Upper bounds on ‖N_ξ g‖_{L¹(I)} for the cells I of width h of a partition of Kest cells, from the masses meas_Lf of g: a point p contributes to ∫_I N_ξ g for the t with p - t ∈ I, a set of measure at most h, so
‖N_ξ g‖_{L¹(I)} ≤ (h/ξ) ‖g‖_{L¹(I ± ξ/2)},and I ± ξ/2 is covered by the cells i - c … i + c, c = ⌈ξ/(2h)⌉.
RigorousInvariantMeasures.estimate_variation_after_noise — Method
estimate_variation_after_noise(meas_Lf, var_Lf, K::UlamProjectedUniformKernel)Upper bounds on Var_I(N_ξ g) for the cells I of a partition of Kest cells of width h, from the masses meas_Lf and variations var_Lf of g on those cells. Since (N_ξ g)' = (g(· + ξ/2) - g(· - ξ/2))/ξ,
Var_I(N_ξ g) ≤ (‖g‖_{L¹(I+ξ/2)} + ‖g‖_{L¹(I-ξ/2)}) / ξ,and since N_ξ g is an average of translates of g,
Var_I(N_ξ g) ≤ (1/ξ) ∫_{|t|≤ξ/2} Var_{I+t}(g) dt ≤ (h/ξ) Var_{I ± ξ/2}(g);the minimum of the two is returned, cell by cell, with the reflecting boundary.
RigorousInvariantMeasures.noise_error_aposteriori — Method
noise_error_aposteriori(prep1, prep2, meas_vec, numeric_error,
B_density::Ulam, K::UlamProjectedUniformKernel,
α, sumCi)Compute the a posteriori L1 error bound for a noisy dynamical system using the actual computed density meas_vec.
Arguments
prep1: output ofprepare_Wnorm_estimateprep2: output ofprepare_derivative_boundsmeas_vec: the computed density vector (approximation of the invariant density)numeric_error: the numerical error from the eigenvector computation (e.g.,residualboundnoise)B_density: theUlambasis on whichmeas_veclivesK: the noise kernel,π_δ N_ξ π_δon the partition ofmeas_vecα,sumCi: for onen,α ≥ ‖L_δⁿ|_V‖ < 1andsumCi ≥ Σ_{i=0}^{n-1} ‖L_δⁱ|_V‖(with‖L_δ⁰|_V‖ = 1), as Lemma 15 and (14) require; a per-step rate is not anα
The estimation partition of prep1 must have a number of cells dividing that of B_density, its cells being unions of cells of the density partition (Lemmas 25, 27).
Returns
(L1Error, apriori_error, Linf_estimate):
L1Error: the a posteriori L1 error bound (should be tighter than generic)apriori_error: the a priori error bound for comparisonLinf_estimate: per-interval L∞ error estimates (vector)
RigorousInvariantMeasures.noise_error_apriori — Method
noise_error_apriori(K_size, noise_size_rel, α, sumCi)Simple a priori error bound for the noisy system.
error ≤ (1/(1-α)) * (2*sumCi + 1) * (δ/2) * varRhowhere δ = 1/K_size and varRho = 2/noise_size_rel.
RigorousInvariantMeasures.noise_support — Method
The noise support ξ of a kernel, as an exact rational.
RigorousInvariantMeasures.prepare_Wnorm_estimate — Method
prepare_Wnorm_estimate(D::PwMap, B_basis::Ulam, B_est::Ulam)For every interval Iᵢ in the estimation partition B_est, compute preimage data under each branch of D.
Returns Vector{Vector{PreimageInfo}} of length length(B_est):
prep[i]contains onePreimageInfoper branch ofDthat has a preimage overlapping with Iᵢ.
This is the Julia equivalent of the Python preparation_for_estimate1.
RigorousInvariantMeasures.prepare_derivative_bounds — Method
prepare_derivative_bounds(D::PwMap, B::Ulam)For each interval in the partition of B, compute an upper bound for |T'|. This is used to estimate the W → W norm.
Returns a Vector{Float64} of length length(B).
RigorousInvariantMeasures.total_variation — Method
total_variation(v::AbstractVector)Compute a rigorous upper bound for the total variation of a step-function represented by the vector v:
Var(v) = Σᵢ |v[i] − v[i+1]|Uses directed rounding (round-up) to keep the result rigorous.
Visualisation (extension)
RigorousInvariantMeasures.plot_noisy_system — Function
plot_noisy_system(D::PwMap, K::UniformKernelUlam, w, L; n_samples=1000, n_points=500)Plot a 3-panel visualization of a dynamical system with uniform noise. Requires using Plots to load the extension that implements this function.
See the PlotsExt extension for full documentation.