Skip to content

Commit

Permalink
Merge c6f5d03 into 1880f7d
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Jun 23, 2017
2 parents 1880f7d + c6f5d03 commit 49d18a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions blas/gonum/dgemm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ func (Implementation) Dgemm(tA, tB blas.Transpose, m, n, k int, alpha float64, a
}
aTrans := tA == blas.Trans || tA == blas.ConjTrans
if aTrans {
checkMatrix64(k, m, a, lda)
checkMatrix64('a', k, m, a, lda)
} else {
checkMatrix64(m, k, a, lda)
checkMatrix64('a', m, k, a, lda)
}
bTrans := tB == blas.Trans || tB == blas.ConjTrans
if bTrans {
checkMatrix64(n, k, b, ldb)
checkMatrix64('b', n, k, b, ldb)
} else {
checkMatrix64(k, n, b, ldb)
checkMatrix64('b', k, n, b, ldb)
}
checkMatrix64(m, n, c, ldc)
checkMatrix64('c', m, n, c, ldc)

// scale c
if beta != 1 {
Expand Down Expand Up @@ -260,7 +260,7 @@ func sliceView64(a []float64, lda, i, j, r, c int) []float64 {
return a[i*lda+j : (i+r-1)*lda+j+c]
}

func checkMatrix64(m, n int, a []float64, lda int) {
func checkMatrix64(name byte, m, n int, a []float64, lda int) {
if m < 0 {
panic("blas: rows < 0")
}
Expand All @@ -271,6 +271,6 @@ func checkMatrix64(m, n int, a []float64, lda int) {
panic("blas: illegal stride")
}
if len(a) < (m-1)*lda+n {
panic("blas: insufficient matrix slice length")
panic("blas: index of " + string(name) + " out of range")
}
}
16 changes: 8 additions & 8 deletions blas/gonum/sgemm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mat/dense_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func TestMul(t *testing.T) {
// These probably warrant a better check and failure. They should never happen in the wild though.
temp.mat.Data = nil
panicked, message := panics(func() { temp.Mul(a, b) })
if !panicked || message != "blas: insufficient matrix slice length" {
if !panicked || message != "blas: index of c out of range" {
if message != "" {
t.Errorf("expected runtime panic for nil data slice: got %q", message)
} else {
Expand Down

0 comments on commit 49d18a4

Please sign in to comment.