From 55a603be8c78cb43b4ed75506409b1413bc67644 Mon Sep 17 00:00:00 2001 From: btracey Date: Sun, 2 Aug 2015 22:56:09 -0600 Subject: [PATCH] Update stat for the new API of MulTrans and MulVec --- covariancematrix.go | 7 ++++--- distmv/normal.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/covariancematrix.go b/covariancematrix.go index 706ab5ce..7a4f9999 100644 --- a/covariancematrix.go +++ b/covariancematrix.go @@ -5,9 +5,10 @@ package stat import ( + "math" + "github.com/gonum/floats" "github.com/gonum/matrix/mat64" - "math" ) // CovarianceMatrix calculates a covariance matrix (also known as a @@ -51,7 +52,7 @@ func CovarianceMatrix(cov *mat64.Dense, x mat64.Matrix, wts []float64) *mat64.De n = float64(r) - cov.MulTrans(&xt, false, &xt, true) + cov.Mul(&xt, (&xt).T()) // Scale by the sample size. cov.Scale(1/(n-1), cov) @@ -74,7 +75,7 @@ func CovarianceMatrix(cov *mat64.Dense, x mat64.Matrix, wts []float64) *mat64.De // Calculate the normalization factor. n = floats.Sum(wts) - cov.MulTrans(&xt, false, &xt, true) + cov.Mul(&xt, (&xt).T()) // Scale by the sample size. cov.Scale(1/(n-1), cov) diff --git a/distmv/normal.go b/distmv/normal.go index 8155016f..ddb6c00c 100644 --- a/distmv/normal.go +++ b/distmv/normal.go @@ -120,7 +120,7 @@ func (n *Normal) Rand(x []float64) []float64 { } tmpVec := mat64.NewVector(n.dim, tmp) xVec := mat64.NewVector(n.dim, x) - xVec.MulVec(n.chol, true, tmpVec) + xVec.MulVec(n.chol.T(), tmpVec) floats.Add(x, n.mu) return x }