Class Mahalanobis
Mahalanobis distance.
Inherited Members
Namespace: ISynergy.Framework.Mathematics.Distances
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public class Mahalanobis : BaseMahalanobis, IMetric<double[]>, IDistance<double[]>, IDistance<double[], double[]>
Constructors
View SourceMahalanobis()
Default constructor.
Declaration
public Mahalanobis()
Mahalanobis(CholeskyDecomposition)
Initializes a new instance of the Mahalanobis class.
Declaration
public Mahalanobis(CholeskyDecomposition chol)
Parameters
Type | Name | Description |
---|---|---|
CholeskyDecomposition | chol | A Cholesky decomposition of the covariance matrix. |
Mahalanobis(SingularValueDecomposition)
Initializes a new instance of the Mahalanobis class.
Declaration
public Mahalanobis(SingularValueDecomposition svd)
Parameters
Type | Name | Description |
---|---|---|
SingularValueDecomposition | svd | A Singular Value decomposition of the covariance matrix. |
Mahalanobis(Double[,])
Initializes a new instance of the Mahalanobis class.
Declaration
public Mahalanobis(double[, ] precision)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | precision | The precision matrix (the inverse of the covariance matrix). |
Methods
View SourceDistance(Double[], Double[])
Computes the distance d(x,y)
between points
x
and y
.
Declaration
public override double Distance(double[] x, double[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | x | The first point |
System.Double[] | y | The second point |
Returns
Type | Description |
---|---|
System.Double | A double-precision value representing the distance |
Overrides
View SourceFromCovarianceMatrix(Double[,])
Creates a new Mahalanobis distance from a covariance matrix.
Declaration
public static Mahalanobis FromCovarianceMatrix(double[, ] covariance)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | covariance | A covariance matrix. |
Returns
Type | Description |
---|---|
Mahalanobis | A Mahalanobis distance using the SingularValueDecomposition of the given covariance matrix. |
FromPrecisionMatrix(Double[,])
Creates a new Mahalanobis distance from a precision matrix.
Declaration
public static Mahalanobis FromPrecisionMatrix(double[, ] precision)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | precision | A precision matrix. |
Returns
Type | Description |
---|---|
Mahalanobis | A Mahalanobis distance using the given precision matrix. |