mat: change cholesky.To to cholesky.ToSym (#250)

* mat: change cholesky.To to cholesky.ToSym

Fixes #133
This commit is contained in:
Brendan Tracey
2017-10-02 15:35:10 -06:00
committed by GitHub
parent 18ecaeca93
commit fa42c6938b
5 changed files with 12 additions and 12 deletions

View File

@@ -219,7 +219,7 @@ func TestCholeskySolveVec(t *testing.T) {
}
}
func TestCholeskyTo(t *testing.T) {
func TestCholeskyToSym(t *testing.T) {
for _, test := range []*SymDense{
NewSymDense(3, []float64{
53, 59, 37,
@@ -232,7 +232,7 @@ func TestCholeskyTo(t *testing.T) {
if !ok {
t.Fatal("unexpected Cholesky factorization failure: not positive definite")
}
s := chol.To(nil)
s := chol.ToSym(nil)
if !EqualApprox(s, test, 1e-12) {
t.Errorf("Cholesky reconstruction not equal to original matrix.\nWant:\n% v\nGot:\n% v\n", Formatted(test), Formatted(s))
@@ -338,7 +338,7 @@ func TestCholeskySymRankOne(t *testing.T) {
a.SymRankOne(&a, alpha, x)
var achol SymDense
chol.To(&achol)
chol.ToSym(&achol)
if !EqualApprox(&achol, &a, 1e-13) {
t.Errorf("n=%v, alpha=%v: mismatch between updated matrix and from Cholesky:\nupdated:\n%v\nfrom Cholesky:\n%v",
n, alpha, Formatted(&a), Formatted(&achol))
@@ -413,7 +413,7 @@ func TestCholeskySymRankOne(t *testing.T) {
a.SymRankOne(a, test.alpha, x)
var achol SymDense
chol.To(&achol)
chol.ToSym(&achol)
if !EqualApprox(&achol, a, 1e-13) {
t.Errorf("Case %v: mismatch between updated matrix and from Cholesky:\nupdated:\n%v\nfrom Cholesky:\n%v",
i, Formatted(a), Formatted(&achol))