Common
A library of common classes.
Maths Class Reference

Contains extra math operations. More...

Static Public Member Functions

static double Clamp01 (double t)
 Clamps the value between 0 and 1. More...
 
static double[] CumSum (IList< double > values)
 Returns the cumulative sums of the list. More...
 
static void CumSum (IList< double > values, List< double > result)
 Adds the cumulative sum of the list to teh specified results list. More...
 
static double[] CumSum (IList< float > values)
 Returns the cumulative sums of the list. More...
 
static void CumSum (IList< float > values, List< double > result)
 Adds the cumulative sum of the list to teh specified results list. More...
 
static double Lerp (double a, double b, double t)
 Linearly interpolates between two points based on a fractional distance parameter. This method will clamp the parameter to [0, 1]. More...
 
static double LerpUnclamped (double a, double b, double t)
 Linearly interpolates between two points based on a fractional distance parameter. More...
 
static int MaxIndex (IList< double > values)
 Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty. More...
 
static int MaxIndex (IList< float > values)
 Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty. More...
 
static int MaxIndex (IList< int > values)
 Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty. More...
 
static int MinIndex (IList< double > values)
 Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty. More...
 
static int MinIndex (IList< float > values)
 Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty. More...
 
static int MinIndex (IList< int > values)
 Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty. More...
 
static double[] Softmax (IList< double > values)
 Returns the softmax of the collection of values. More...
 
static double[] Softmax (IList< float > values)
 Returns the softmax of the collection of values. More...
 

Detailed Description

Contains extra math operations.

Definition at line 9 of file Maths.cs.

Member Function Documentation

◆ Clamp01()

static double Clamp01 ( double  t)
static

Clamps the value between 0 and 1.

Parameters
tThe value.

Definition at line 313 of file Maths.cs.

◆ CumSum() [1/4]

static double[] CumSum ( IList< double >  values)
static

Returns the cumulative sums of the list.

Parameters
valuesA list of values.

Definition at line 15 of file Maths.cs.

◆ CumSum() [2/4]

static void CumSum ( IList< double >  values,
List< double >  result 
)
static

Adds the cumulative sum of the list to teh specified results list.

Parameters
valuesA list of values.
resultThe results list.

Definition at line 37 of file Maths.cs.

◆ CumSum() [3/4]

static double[] CumSum ( IList< float >  values)
static

Returns the cumulative sums of the list.

Parameters
valuesA list of values.

Definition at line 53 of file Maths.cs.

◆ CumSum() [4/4]

static void CumSum ( IList< float >  values,
List< double >  result 
)
static

Adds the cumulative sum of the list to teh specified results list.

Parameters
valuesA list of values.
resultThe results list.

Definition at line 75 of file Maths.cs.

◆ Lerp()

static double Lerp ( double  a,
double  b,
double  t 
)
static

Linearly interpolates between two points based on a fractional distance parameter. This method will clamp the parameter to [0, 1].

Parameters
aThe first point.
bThe second point.
tThe fractional distance parameter, measured from the first point.

Definition at line 329 of file Maths.cs.

◆ LerpUnclamped()

static double LerpUnclamped ( double  a,
double  b,
double  t 
)
static

Linearly interpolates between two points based on a fractional distance parameter.

Parameters
aThe first point.
bThe second point.
tThe fractional distance parameter, measured from the first point.

Definition at line 340 of file Maths.cs.

◆ MaxIndex() [1/3]

static int MaxIndex ( IList< double >  values)
static

Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 179 of file Maths.cs.

◆ MaxIndex() [2/3]

static int MaxIndex ( IList< float >  values)
static

Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 152 of file Maths.cs.

◆ MaxIndex() [3/3]

static int MaxIndex ( IList< int >  values)
static

Returns the index in the collection where the first maximum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 206 of file Maths.cs.

◆ MinIndex() [1/3]

static int MinIndex ( IList< double >  values)
static

Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 260 of file Maths.cs.

◆ MinIndex() [2/3]

static int MinIndex ( IList< float >  values)
static

Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 233 of file Maths.cs.

◆ MinIndex() [3/3]

static int MinIndex ( IList< int >  values)
static

Returns the index in the collection where the first minimum value occurs. Returns -1 if the collection is empty.

Parameters
valuesThe collection of values.

Definition at line 287 of file Maths.cs.

◆ Softmax() [1/2]

static double[] Softmax ( IList< double >  values)
static

Returns the softmax of the collection of values.

Parameters
valuesA list of values.

Definition at line 91 of file Maths.cs.

◆ Softmax() [2/2]

static double[] Softmax ( IList< float >  values)
static

Returns the softmax of the collection of values.

Parameters
valuesA list of values.

Definition at line 121 of file Maths.cs.


The documentation for this class was generated from the following file: