mat: Add Zero method to reset values of matrices (#819)

* mat: Add Zero method to reset values of matrices
This commit is contained in:
Brendan Tracey
2019-01-27 22:16:06 +00:00
committed by GitHub
parent 38017c6036
commit bcbf6c8e4e
16 changed files with 388 additions and 0 deletions

View File

@@ -178,6 +178,13 @@ func (v *VecDense) Reset() {
v.mat.Data = v.mat.Data[:0]
}
// Zero sets all of the matrix elements to zero.
func (v *VecDense) Zero() {
for i := 0; i < v.mat.N; i++ {
v.mat.Data[v.mat.Inc*i] = 0
}
}
// CloneVec makes a copy of a into the receiver, overwriting the previous value
// of the receiver.
func (v *VecDense) CloneVec(a Vector) {