mat: relax list test type restrictions for Vector parameters

This commit is contained in:
Dan Kortschak
2017-12-27 19:24:49 +10:30
committed by GitHub
parent 6e57d606a5
commit cd47c93d54
4 changed files with 31 additions and 14 deletions

View File

@@ -371,14 +371,18 @@ type basicVector struct {
m []float64
}
func (v *basicVector) AtVec(i int) float64 {
if i < 0 || i >= v.Len() {
panic(ErrRowAccess)
}
return v.m[i]
}
func (v *basicVector) At(r, c int) float64 {
if c != 0 {
panic(ErrColAccess)
}
if r < 0 || r >= v.Len() {
panic(ErrRowAccess)
}
return v.m[r]
return v.AtVec(r)
}
func (v *basicVector) Dims() (r, c int) {
@@ -411,7 +415,7 @@ func TestDot(t *testing.T) {
}
return sum
}
testTwoInputFunc(t, "Dot", f, denseComparison, sameAnswerFloatApproxTol(1e-12), legalTypesVecVec, legalSizeSameVec)
testTwoInputFunc(t, "Dot", f, denseComparison, sameAnswerFloatApproxTol(1e-12), legalTypesVectorVector, legalSizeSameVec)
}
func TestEqual(t *testing.T) {