mat: clean up lint
MODIFY
mat/cholesky_test.go
mat/cholesky_test.go
@@ -134,7 +134,10 @@ func TestCholeskySolveTo(t *testing.T) {
}
var x Dense
- chol.SolveTo(&x, test.b)
+ err := chol.SolveTo(&x, test.b)
+ if err != nil {
+ t.Errorf("unexpected error from Cholesky solve: %v", err)
+ }
if !EqualApprox(&x, test.ans, 1e-12) {
t.Error("incorrect Cholesky solve solution")
}
@@ -195,13 +198,19 @@ func TestCholeskySolveCholTo(t *testing.T) {
}
var x Dense
- chola.SolveCholTo(&x, &cholb)
+ err := chola.SolveCholTo(&x, &cholb)
+ if err != nil {
+ t.Errorf("unexpected error from Cholesky solve: %v", err)
+ }
var ans Dense
ans.Mul(test.a, &x)
if !EqualApprox(&ans, test.b, 1e-12) {
var y Dense
- y.Solve(test.a, test.b)
+ err := y.Solve(test.a, test.b)
+ if err != nil {
+ t.Errorf("unexpected error from dense solve: %v", err)
+ }
t.Errorf("incorrect Cholesky solve solution product\ngot solution:\n%.4v\nwant solution\n%.4v",
Formatted(&x), Formatted(&y))
}
@@ -239,7 +248,10 @@ func TestCholeskySolveVecTo(t *testing.T) {
}
var x VecDense
- chol.SolveVecTo(&x, test.b)
+ err := chol.SolveVecTo(&x, test.b)
+ if err != nil {
+ t.Errorf("unexpected error from Cholesky solve: %v", err)
+ }
if !EqualApprox(&x, test.ans, 1e-12) {
t.Error("incorrect Cholesky solve solution")
}
@@ -326,7 +338,10 @@ func TestCholeskyInverseTo(t *testing.T) {
}
var sInv SymDense
- chol.InverseTo(&sInv)
+ err := chol.InverseTo(&sInv)
+ if err != nil {
+ t.Errorf("unexpected error from Cholesky inverse: %v", err)
+ }
var ans Dense
ans.Mul(&sInv, &s)
@@ -672,7 +687,10 @@ func BenchmarkCholeskyInverseTo(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
- chol.InverseTo(dst)
+ err := chol.InverseTo(dst)
+ if err != nil {
+ b.Fatalf("unexpected error from Cholesky inverse: %v", err)
+ }
}
})
}

MODIFY
mat/dense_arithmetic.go
mat/dense_arithmetic.go
@@ -545,7 +545,7 @@ func (m *Dense) Exp(a Matrix) {
vpu.Add(v, u)
vmu.Sub(v, u)
- m.Solve(vmu, vpu)
+ _ = m.Solve(vmu, vpu)
return
}
@@ -615,7 +615,7 @@ func (m *Dense) Exp(a Matrix) {
vpu.Add(v, u)
vmu.Sub(v, u)
- m.Solve(vmu, vpu)
+ _ = m.Solve(vmu, vpu)
for ; s > 0; s-- {
m.Mul(m, m)

MODIFY
mat/io_test.go
mat/io_test.go
@@ -584,7 +584,10 @@ func marshalBinaryBenchDense(b *testing.B, size int) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
- m.MarshalBinary()
+ _, err := m.MarshalBinary()
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -606,7 +609,10 @@ func unmarshalBinaryBenchDense(b *testing.B, size int) {
for n := 0; n < b.N; n++ {
var m Dense
- m.UnmarshalBinary(buf)
+ err := m.UnmarshalBinary(buf)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -625,7 +631,10 @@ func marshalBinaryToBenchDense(b *testing.B, size int) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
- m.MarshalBinaryTo(w)
+ _, err := m.MarshalBinaryTo(w)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -663,7 +672,10 @@ func unmarshalBinaryFromBenchDense(b *testing.B, size int) {
for n := 0; n < b.N; n++ {
var m Dense
- m.UnmarshalBinaryFrom(r)
+ _, err := m.UnmarshalBinaryFrom(r)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
r.reset()
}
}
@@ -682,7 +694,10 @@ func marshalBinaryBenchVecDense(b *testing.B, size int) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
- vec.MarshalBinary()
+ _, err := vec.MarshalBinary()
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -704,7 +719,10 @@ func unmarshalBinaryBenchVecDense(b *testing.B, size int) {
for n := 0; n < b.N; n++ {
var vec VecDense
- vec.UnmarshalBinary(buf)
+ err := vec.UnmarshalBinary(buf)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -723,7 +741,10 @@ func marshalBinaryToBenchVecDense(b *testing.B, size int) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
- vec.MarshalBinaryTo(w)
+ _, err := vec.MarshalBinaryTo(w)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
}
}
@@ -746,7 +767,10 @@ func unmarshalBinaryFromBenchVecDense(b *testing.B, size int) {
for n := 0; n < b.N; n++ {
var vec VecDense
- vec.UnmarshalBinaryFrom(r)
+ _, err := vec.UnmarshalBinaryFrom(r)
+ if err != nil {
+ b.Fatalf("unexpected error: %v", err)
+ }
r.reset()
}
}

MODIFY
mat/list_test.go
mat/list_test.go
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//nolint:deadcode,unused
package mat
import (

MODIFY
mat/symmetric_test.go
mat/symmetric_test.go
@@ -724,7 +724,10 @@ func TestPowPSD(t *testing.T) {
mat.SymOuterK(1, a)
var sym SymDense
- sym.PowPSD(&mat, float64(pow))
+ err := sym.PowPSD(&mat, float64(pow))
+ if err != nil {
+ t.Errorf("unexpected error: %v", err)
+ }
var dense Dense
dense.Pow(&mat, pow)

MODIFY
mat/triangular.go
mat/triangular.go
@@ -178,17 +178,6 @@ func isUpperUplo(u blas.Uplo) bool {
}
}
-func uploToTriKind(u blas.Uplo) TriKind {
- switch u {
- case blas.Upper:
- return Upper
- case blas.Lower:
- return Lower
- default:
- panic(badTriangle)
- }
-}
-
// asSymBlas returns the receiver restructured as a blas64.Symmetric with the
// same backing memory. Panics if the receiver is unit.
// This returns a blas64.Symmetric and not a *SymDense because SymDense can only

mat: clean up lint