mat: Expose ReuseAs method to help resizing (#1082)

* mat: Expose ReuseAs method to help resizing

Fixes #963
This commit is contained in:
Brendan Tracey
2019-09-14 09:17:29 +01:00
committed by GitHub
parent 40d3308efe
commit cd52c4d030
24 changed files with 366 additions and 107 deletions

View File

@@ -24,7 +24,7 @@ func (m *Dense) Solve(a, b Matrix) error {
if ar != br {
panic(ErrShape)
}
m.reuseAs(ac, bc)
m.reuseAsNonZeroed(ac, bc)
// TODO(btracey): Add special cases for SymDense, etc.
aU, aTrans := untranspose(a)
@@ -121,7 +121,7 @@ func (v *VecDense) SolveVec(a Matrix, b Vector) error {
if v != b {
v.checkOverlap(bmat)
}
v.reuseAs(c)
v.reuseAsNonZeroed(c)
m := v.asDense()
// We conditionally create bm as m when b and v are identical
// to prevent the overlap detection code from identifying m
@@ -134,7 +134,7 @@ func (v *VecDense) SolveVec(a Matrix, b Vector) error {
return m.Solve(a, bm)
}
v.reuseAs(c)
v.reuseAsNonZeroed(c)
m := v.asDense()
return m.Solve(a, b)
}