Table of Contents

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

function Func<double[], object, double>

Function to approximate: f(point, data) → double.

numDimensions int

Total number of input dimensions.

domain double[][]

Bounds for each dimension as double[ndim][2].

nNodes int[]

Number of Chebyshev nodes per dimension.

partition int[][]

Grouping of dimension indices into slides. Each dimension must appear exactly once.

pivotPoint double[]

Reference point z around which slides are built.

maxDerivativeOrder int

Maximum derivative order to support (default 2).

Properties

BuildTime

Wall-clock time (seconds) for the most recent Build() call.

public double BuildTime { get; }

Property Value

double

Built

Whether Build() has been called.

public bool Built { get; }

Property Value

bool

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

Func<double[], object, double>

MaxDerivativeOrder

Maximum supported derivative order.

public int MaxDerivativeOrder { get; }

Property Value

int

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

int

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

double

TotalBuildEvals

Total number of function evaluations used during build.

public int TotalBuildEvals { get; }

Property Value

int

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

verbose bool

If 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

point double[]

Evaluation point in the full n-dimensional space.

derivativeOrder int[]

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

point double[]

Evaluation point.

derivativeOrders int[][]

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

extrudeParams (int dimIndex, double[] bounds, int nNodes)[]

Tuples of (dimIndex, bounds, nNodes).

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

path string

Path 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

path string

Destination 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

sliceParams (int dimIndex, double value)[]

Tuples of (dimIndex, value).

Returns

ChebyshevSlider

A new, lower-dimensional slider (already built).

ToReprString()

Compact repr string.

public string ToReprString()

Returns

string

ToString()

Multi-line display string.

public override string ToString()

Returns

string

Operators

operator +(ChebyshevSlider, ChebyshevSlider)

Pointwise addition of two sliders on the same grid.

public static ChebyshevSlider operator +(ChebyshevSlider a, ChebyshevSlider b)

Parameters

a ChebyshevSlider
b ChebyshevSlider

Returns

ChebyshevSlider

operator /(ChebyshevSlider, double)

Scalar division.

public static ChebyshevSlider operator /(ChebyshevSlider a, double scalar)

Parameters

a ChebyshevSlider
scalar double

Returns

ChebyshevSlider

operator *(ChebyshevSlider, double)

Scalar multiplication.

public static ChebyshevSlider operator *(ChebyshevSlider a, double scalar)

Parameters

a ChebyshevSlider
scalar double

Returns

ChebyshevSlider

operator *(double, ChebyshevSlider)

Scalar multiplication (scalar on left).

public static ChebyshevSlider operator *(double scalar, ChebyshevSlider a)

Parameters

scalar double
a ChebyshevSlider

Returns

ChebyshevSlider

operator -(ChebyshevSlider, ChebyshevSlider)

Pointwise subtraction of two sliders on the same grid.

public static ChebyshevSlider operator -(ChebyshevSlider a, ChebyshevSlider b)

Parameters

a ChebyshevSlider
b ChebyshevSlider

Returns

ChebyshevSlider

operator -(ChebyshevSlider)

Unary negation.

public static ChebyshevSlider operator -(ChebyshevSlider a)

Parameters

a ChebyshevSlider

Returns

ChebyshevSlider