PiecewiseLinearFunction Class

Represents a piecewise linear function for calculating values between pivot points.

Definition

Namespace: Gemstone.Numeric.Interpolation
Assembly: Gemstone.Numeric (in Gemstone.Numeric.dll) Version: 1.0.167 -- Release Build+9e631c9f4ed4cd2c2da47045792d813c2de0c4a8
public class PiecewiseLinearFunction
Inheritance
Object    PiecewiseLinearFunction

Remarks

The conversion function returned by this class uses a binary search algorithm to find the appropriate line segment to use for the calculation. Therefore, the domain must be specified either in increasing or decreasing order.

Here is an example of how to use this class.

Func<double, double> piecewiseLinearFunc = new PiecewiseLinearFunction() .SetDomain(-1, 0, 1) .SetRange(0, 1, 0); Console.WriteLine(piecewiseLinearFunc(-10)); // -9 Console.WriteLine(piecewiseLinearFunc(-1)); // 0 Console.WriteLine(piecewiseLinearFunc(-0.5)); // 0.5 Console.WriteLine(piecewiseLinearFunc(0)); // 1 Console.WriteLine(piecewiseLinearFunc(0.5)); // 0.5 Console.WriteLine(piecewiseLinearFunc(1)); // 0 Console.WriteLine(piecewiseLinearFunc(10)); // -9

Constructors

PiecewiseLinearFunctionInitializes a new instance of the PiecewiseLinearFunction class

Properties

Domain Gets the x-values of the pivot points in the piecewise linear function.
Range Gets the y-values of the pivot points in the piecewise linear function.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
SetDomain Sets the x-values of the pivot points in the piecewise linear function.
SetRange Sets the y-values of the pivot points in the piecewise linear function.
ToStringReturns a string that represents the current object.
(Inherited from Object)

Operators

(PiecewiseLinearFunction to FuncDouble, Double) Converts the PiecewiseLinearFunction object to a FuncT, TResult to start converting values.

See Also