mat: Rename Solve(Vec) to Solve(Vec)To (#922)

* mat: Rename Solve(Vec) to Solev(Vec)To

Fix #830.
This commit is contained in:
Brendan Tracey
2019-03-28 01:01:36 +00:00
committed by GitHub
parent 9996f1428e
commit a65628b4b5
17 changed files with 120 additions and 118 deletions

View File

@@ -70,7 +70,7 @@ func isOrthonormal(q *Dense, tol float64) bool {
return true
}
func TestSolveQR(t *testing.T) {
func TestQRSolveTo(t *testing.T) {
for _, trans := range []bool{false, true} {
for _, test := range []struct {
m, n, bc int
@@ -102,7 +102,7 @@ func TestSolveQR(t *testing.T) {
var x Dense
var qr QR
qr.Factorize(a)
qr.Solve(&x, trans, b)
qr.SolveTo(&x, trans, b)
// Test that the normal equations hold.
// A^T * A * x = A^T * b if !trans
@@ -128,7 +128,7 @@ func TestSolveQR(t *testing.T) {
// TODO(btracey): Add in testOneInput when it exists.
}
func TestSolveQRVec(t *testing.T) {
func TestQRSolveVecTo(t *testing.T) {
for _, trans := range []bool{false, true} {
for _, test := range []struct {
m, n int
@@ -155,7 +155,7 @@ func TestSolveQRVec(t *testing.T) {
var x VecDense
var qr QR
qr.Factorize(a)
qr.SolveVec(&x, trans, b)
qr.SolveVecTo(&x, trans, b)
// Test that the normal equations hold.
// A^T * A * x = A^T * b if !trans
@@ -181,7 +181,7 @@ func TestSolveQRVec(t *testing.T) {
// TODO(btracey): Add in testOneInput when it exists.
}
func TestSolveQRCond(t *testing.T) {
func TestQRSolveCondTo(t *testing.T) {
for _, test := range []*Dense{
NewDense(2, 2, []float64{1, 0, 0, 1e-20}),
NewDense(3, 2, []float64{1, 0, 0, 1e-20, 0, 0}),
@@ -191,13 +191,13 @@ func TestSolveQRCond(t *testing.T) {
qr.Factorize(test)
b := NewDense(m, 2, nil)
var x Dense
if err := qr.Solve(&x, false, b); err == nil {
if err := qr.SolveTo(&x, false, b); err == nil {
t.Error("No error for near-singular matrix in matrix solve.")
}
bvec := NewVecDense(m, nil)
var xvec VecDense
if err := qr.SolveVec(&xvec, false, bvec); err == nil {
if err := qr.SolveVecTo(&xvec, false, bvec); err == nil {
t.Error("No error for near-singular matrix in matrix solve.")
}
}