pub struct ScalarChebyshevPlan { /* private fields */ }Expand description
Chebyshev-in-density interpolant of T_i(n) for scalar (k = 1)
forward models. For each row i, pre-samples T_i(n_j) at
M Chebyshev-of-the-first-kind nodes in [0, n_max], then
stores the Chebyshev coefficients. Online evaluation is
Clenshaw recurrence with M multiply-adds per row.
Unlike the Gauss quadrature, the Chebyshev representation is a
scalar interpolant in density space — one pass evaluates
the interpolant at n, and the derivative needs a separate
derivative-coefficient series.
Implementations§
Source§impl ScalarChebyshevPlan
impl ScalarChebyshevPlan
Sourcepub fn build(
source_resolution_plan: Arc<ResolutionPlan>,
sigma: &[f64],
n_max: f64,
m: usize,
) -> Result<Self, ScalarSurrogateBuildError>
pub fn build( source_resolution_plan: Arc<ResolutionPlan>, sigma: &[f64], n_max: f64, m: usize, ) -> Result<Self, ScalarSurrogateBuildError>
Build an M-node Chebyshev-in-density plan from a shared
crate::resolution::ResolutionPlan + scalar σ + density
box [0, n_max].
The source_resolution_plan Arc is stored on the plan
so the dispatch-time eligibility check can use
Arc::ptr_eq to refuse stale plans on the same grid
(independent review on PR #475). A matching σ fingerprint
is also computed and stored for the same reason: same-grid
σ-mismatch would otherwise trigger silently-wrong
transmissions.
Internally calls source_resolution_plan.compile_to_matrix()
once, then crate::resolution::apply_r M times (one per
Chebyshev node) to get exact row evaluations, then runs a
per-row discrete cosine transform to extract Chebyshev
coefficients.
Cost: one matrix compile + M × N × avg_nnz_per_row FMAs
for the exact sampling pass, plus M^2 per row for the DCT.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn target_energies(&self) -> &[f64]
pub fn n_max(&self) -> f64
pub fn m(&self) -> usize
pub fn density_box(&self) -> Option<f64>
Sourcepub fn source_resolution_plan(&self) -> &Arc<ResolutionPlan>
pub fn source_resolution_plan(&self) -> &Arc<ResolutionPlan>
Accessor for the shared
crate::resolution::ResolutionPlan the plan was built from.
Dispatch uses Arc::ptr_eq between this and the model’s
currently attached resolution_plan as the O(1) identity
check that refuses stale plans on the same grid.
Sourcepub fn sigma_fingerprint(&self) -> u64
pub fn sigma_fingerprint(&self) -> u64
FNV-1a-64 fingerprint of the σ slice (by to_bits()) the
plan was built from. Dispatch recomputes from the model’s
current σ and compares to catch same-grid σ-mismatch.
Sourcepub fn forward_scalar(&self, n: f64) -> Vec<f64>
pub fn forward_scalar(&self, n: f64) -> Vec<f64>
Evaluate the Chebyshev interpolant at density n. Density
outside [0, n_max] extrapolates (caller responsibility —
dispatch should reject via the density-box check).
Sourcepub fn forward_and_derivative_scalar(&self, n: f64) -> (Vec<f64>, Vec<f64>)
pub fn forward_and_derivative_scalar(&self, n: f64) -> (Vec<f64>, Vec<f64>)
Evaluate forward + derivative in one pass. The derivative
of a Chebyshev series can be evaluated via a modified
Clenshaw recurrence that internally tracks the derivative
coefficients — or we use the standard identity
T_k'(x) = k · U_{k-1}(x) (Chebyshev-of-the-second-kind
recurrence). Here we run two parallel Clenshaw sweeps: one
for T(x) and one for d/dx T(x), then scale by
dx/dn = 2 / n_max.
Trait Implementations§
Source§impl Clone for ScalarChebyshevPlan
impl Clone for ScalarChebyshevPlan
Source§fn clone(&self) -> ScalarChebyshevPlan
fn clone(&self) -> ScalarChebyshevPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ScalarChebyshevPlan
impl RefUnwindSafe for ScalarChebyshevPlan
impl Send for ScalarChebyshevPlan
impl Sync for ScalarChebyshevPlan
impl Unpin for ScalarChebyshevPlan
impl UnsafeUnpin for ScalarChebyshevPlan
impl UnwindSafe for ScalarChebyshevPlan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more