Class ChebyshevSlider
- Namespace
- ChebyshevSharp
- Assembly
- ChebyshevSharp.dll
Chebyshev Sliding approximation for high-dimensional functions. Decomposes f(x₁, …, xₙ) into a sum of low-dimensional Chebyshev interpolants (slides) around a pivot point z: f(x) ≈ f(z) + Σᵢ [sᵢ(x_groupᵢ) - f(z)] where each slide sᵢ is a ChebyshevApproximation built on a subset of dimensions with the remaining dimensions fixed at z.
public class ChebyshevSlider
- Inheritance
-
ChebyshevSlider
- Inherited Members
Remarks
This trades accuracy for dramatically reduced build cost: instead of evaluating f at n₁ × n₂ × … × nₐ grid points (exponential), the slider evaluates at n₁ × n₂ + n₃ × n₄ + … (sum of products within each group). Reference: Ruiz & Zeron (2022), Ch. 7.
Constructors
ChebyshevSlider(Func<double[], object?, double>, int, double[][], int[], int[][], double[], int)
Create a new ChebyshevSlider.
public ChebyshevSlider(Func<double[], object?, double> function, int numDimensions, double[][] domain, int[] nNodes, int[][] partition, double[] pivotPoint, int maxDerivativeOrder = 2)
Parameters
functionFunc<double[], object, double>Function to approximate: f(point, data) → double.
numDimensionsintTotal number of input dimensions.
domaindouble[][]Bounds for each dimension as double[ndim][2].
nNodesint[]Number of Chebyshev nodes per dimension.
partitionint[][]Grouping of dimension indices into slides. Each dimension must appear exactly once.
pivotPointdouble[]Reference point z around which slides are built.
maxDerivativeOrderintMaximum derivative order to support (default 2).
Properties
BuildTime
Wall-clock time (seconds) for the most recent Build() call.
public double BuildTime { get; }
Property Value
Built
Whether Build() has been called.
public bool Built { get; }
Property Value
Domain
Domain bounds for each dimension, as list of [lo, hi].
public double[][] Domain { get; }
Property Value
- double[][]
Function
The function to approximate. Null after load.
public Func<double[], object?, double>? Function { get; }
Property Value
MaxDerivativeOrder
Maximum supported derivative order.
public int MaxDerivativeOrder { get; }
Property Value
NNodes
Number of Chebyshev nodes per dimension.
public int[] NNodes { get; }
Property Value
- int[]
NumDimensions
Number of input dimensions.
public int NumDimensions { get; }
Property Value
Partition
Grouping of dimension indices into slides.
public int[][] Partition { get; }
Property Value
- int[][]
PivotPoint
Reference point z around which slides are built.
public double[] PivotPoint { get; }
Property Value
- double[]
PivotValue
Function value at the pivot point: f(z).
public double PivotValue { get; }
Property Value
TotalBuildEvals
Total number of function evaluations used during build.
public int TotalBuildEvals { get; }
Property Value
Methods
Build(bool)
Build all slides by evaluating the function at slide-specific grids. For each slide, dimensions outside the group are fixed at pivot values.
public void Build(bool verbose = true)
Parameters
verboseboolIf true, print build progress.
ErrorEstimate()
Estimate the sliding approximation error. Returns the sum of per-slide Chebyshev error estimates. Note: this captures per-slide interpolation error only; cross-group interaction error inherent to the sliding decomposition is not included.
public double ErrorEstimate()
Returns
- double
Estimated interpolation error (per-slide sum).
Eval(double[], int[])
Evaluate the slider approximation at a point. Uses Equation 7.5: f(x) ≈ f(z) + Σᵢ [sᵢ(x_groupᵢ) - f(z)]. For derivatives, only the slide containing that dimension contributes. Cross-group mixed partials are exactly zero.
public double Eval(double[] point, int[] derivativeOrder)
Parameters
pointdouble[]Evaluation point in the full n-dimensional space.
derivativeOrderint[]Derivative order for each dimension (0 = function value).
Returns
- double
Approximated function value or derivative.
EvalMulti(double[], int[][])
Evaluate slider at multiple derivative orders for the same point.
public double[] EvalMulti(double[] point, int[][] derivativeOrders)
Parameters
pointdouble[]Evaluation point.
derivativeOrdersint[][]Each inner array specifies derivative order per dimension.
Returns
- double[]
Results for each derivative order.
Extrude(params (int dimIndex, double[] bounds, int nNodes)[])
Add new dimensions where the function is constant. Each new dimension becomes its own single-dim slide group with constant tensor values equal to PivotValue, so it contributes nothing to the sliding sum.
public ChebyshevSlider Extrude(params (int dimIndex, double[] bounds, int nNodes)[] extrudeParams)
Parameters
Returns
- ChebyshevSlider
A new, higher-dimensional slider (already built).
Load(string)
Load a previously saved slider from a JSON file.
public static ChebyshevSlider Load(string path)
Parameters
pathstringPath to the saved file.
Returns
- ChebyshevSlider
A fully functional slider with Function=null.
Save(string)
Save the built slider to a JSON file.
public void Save(string path)
Parameters
pathstringDestination file path.
Slice(params (int dimIndex, double value)[])
Fix one or more dimensions at given values, reducing dimensionality.
public ChebyshevSlider Slice(params (int dimIndex, double value)[] sliceParams)
Parameters
Returns
- ChebyshevSlider
A new, lower-dimensional slider (already built).
ToReprString()
Compact repr string.
public string ToReprString()
Returns
ToString()
Multi-line display string.
public override string ToString()
Returns
Operators
operator +(ChebyshevSlider, ChebyshevSlider)
Pointwise addition of two sliders on the same grid.
public static ChebyshevSlider operator +(ChebyshevSlider a, ChebyshevSlider b)
Parameters
Returns
operator /(ChebyshevSlider, double)
Scalar division.
public static ChebyshevSlider operator /(ChebyshevSlider a, double scalar)
Parameters
aChebyshevSliderscalardouble
Returns
operator *(ChebyshevSlider, double)
Scalar multiplication.
public static ChebyshevSlider operator *(ChebyshevSlider a, double scalar)
Parameters
aChebyshevSliderscalardouble
Returns
operator *(double, ChebyshevSlider)
Scalar multiplication (scalar on left).
public static ChebyshevSlider operator *(double scalar, ChebyshevSlider a)
Parameters
scalardoubleaChebyshevSlider
Returns
operator -(ChebyshevSlider, ChebyshevSlider)
Pointwise subtraction of two sliders on the same grid.
public static ChebyshevSlider operator -(ChebyshevSlider a, ChebyshevSlider b)
Parameters
Returns
operator -(ChebyshevSlider)
Unary negation.
public static ChebyshevSlider operator -(ChebyshevSlider a)