Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Add comment to Vector.Reset
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Oct 9, 2015
1 parent bfe594e commit d0a9cf9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mat64/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ func (v *Vector) T() Matrix {
return Transpose{v}
}

// Reset zeros the length of the vector so that it can be reused as the
// receiver of a dimensionally restricted operation.
//
// See the Reseter interface for more information.
func (v *Vector) Reset() {
v.mat.Data = v.mat.Data[:0]
// No change of Inc or n to 0 may be
// made unless both are set to 0.
v.mat.Inc = 0
v.n = 0
v.mat.Data = v.mat.Data[:0]
}

func (v *Vector) RawVector() blas64.Vector {
Expand Down Expand Up @@ -329,7 +335,7 @@ func (v *Vector) reuseAs(r int) {

func (v *Vector) isZero() bool {
// It must be the case that v.Dims() returns
// zeros in this case.
// zeros in this case. See comment in Reset().
return v.mat.Inc == 0
}

Expand Down

0 comments on commit d0a9cf9

Please sign in to comment.