mirror of
https://github.com/gonum/gonum.git
synced 2025-11-03 11:21:14 +08:00
stat: generalise Mehalanobis vector parameters
This commit is contained in:
@@ -130,11 +130,11 @@ func corrToCov(c *mat.SymDense, sigma []float64) {
|
||||
|
||||
// Mahalanobis computes the Mahalanobis distance
|
||||
// D = sqrt((x-y)^T * Σ^-1 * (x-y))
|
||||
// between the vectors x and y given the cholesky decomposition of Σ.
|
||||
// between the column vectors x and y given the cholesky decomposition of Σ.
|
||||
// Mahalanobis returns NaN if the linear solve fails.
|
||||
//
|
||||
// See https://en.wikipedia.org/wiki/Mahalanobis_distance for more information.
|
||||
func Mahalanobis(x, y *mat.VecDense, chol *mat.Cholesky) float64 {
|
||||
func Mahalanobis(x, y mat.Vector, chol *mat.Cholesky) float64 {
|
||||
var diff mat.VecDense
|
||||
diff.SubVec(x, y)
|
||||
var tmp mat.VecDense
|
||||
|
||||
Reference in New Issue
Block a user