diff --git a/mat64/dense_arithmetic.go b/mat64/dense_arithmetic.go index 9a98c75..7d0f463 100644 --- a/mat64/dense_arithmetic.go +++ b/mat64/dense_arithmetic.go @@ -528,9 +528,6 @@ func (m *Dense) Pow(a Matrix, n int) { m.Copy(a) return case 2: - for i := 0; i < r; i++ { - zero(m.mat.Data[i*m.mat.Stride : i*m.mat.Stride+c]) - } m.Mul(a, a) return } diff --git a/mat64/dense_test.go b/mat64/dense_test.go index cfe3de8..3d4c106 100644 --- a/mat64/dense_test.go +++ b/mat64/dense_test.go @@ -604,6 +604,9 @@ func (s *S) TestPow(c *check.C) { d[i] = math.NaN() } *a = *NewDense(10, 10, d).View(1, 1, 3, 3).(*Dense) + for i := 0; i < a.mat.Rows; i++ { + zero(a.mat.Data[i*a.mat.Stride : i*a.mat.Stride+a.mat.Cols]) + } }, }, { @@ -621,6 +624,9 @@ func (s *S) TestPow(c *check.C) { d[i] = math.NaN() } *a = *NewDense(10, 10, d).View(1, 1, 3, 3).(*Dense) + for i := 0; i < a.mat.Rows; i++ { + zero(a.mat.Data[i*a.mat.Stride : i*a.mat.Stride+a.mat.Cols]) + } }, }, } {