blas/gonum: remove negativeN panic string
nLT0 serves the same purpose and fits with other similarly named
strings.
MODIFY
blas/gonum/gonum.go
blas/gonum/gonum.go
@@ -12,7 +12,6 @@ type Implementation struct{}
// The following are panic strings used during parameter checks.
const (
- negativeN = "blas: n < 0"
zeroIncX = "blas: zero x index increment"
zeroIncY = "blas: zero y index increment"
badLenX = "blas: x index out of range"

MODIFY
blas/gonum/level1cmplx128.go
blas/gonum/level1cmplx128.go
@@ -15,7 +15,7 @@ import (
// Dzasum returns 0 if incX is negative.
func (Implementation) Dzasum(n int, x []complex128, incX int) float64 {
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if incX < 1 {
if incX == 0 {
@@ -57,7 +57,7 @@ func (Implementation) Dznrm2(n int, x []complex128, incX int) float64 {
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if (n-1)*incX >= len(x) {
panic(badX)
@@ -131,7 +131,7 @@ func (Implementation) Izamax(n int, x []complex128, incX int) int {
// Return invalid index.
return -1
}
- panic(negativeN)
+ panic(nLT0)
}
if len(x) <= (n-1)*incX {
panic(badX)
@@ -173,7 +173,7 @@ func (Implementation) Zaxpy(n int, alpha complex128, x []complex128, incX int, y
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -210,7 +210,7 @@ func (Implementation) Zcopy(n int, x []complex128, incX int, y []complex128, inc
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -250,7 +250,7 @@ func (Implementation) Zdotc(n int, x []complex128, incX int, y []complex128, inc
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {
@@ -291,7 +291,7 @@ func (Implementation) Zdotu(n int, x []complex128, incX int, y []complex128, inc
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {
@@ -334,7 +334,7 @@ func (Implementation) Zdscal(n int, alpha float64, x []complex128, incX int) {
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if alpha == 0 {
if incX == 1 {
@@ -378,7 +378,7 @@ func (Implementation) Zscal(n int, alpha complex128, x []complex128, incX int) {
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if alpha == 0 {
if incX == 1 {
@@ -412,7 +412,7 @@ func (Implementation) Zswap(n int, x []complex128, incX int, y []complex128, inc
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)

MODIFY
blas/gonum/level1double.go
blas/gonum/level1double.go
@@ -33,9 +33,7 @@ func (Implementation) Dnrm2(n int, x []float64, incX int) float64 {
if n == 0 {
return 0
}
- if n < 1 {
- panic(negativeN)
- }
+ panic(nLT0)
}
var (
scale float64 = 0
@@ -91,7 +89,7 @@ func (Implementation) Dnrm2(n int, x []float64, incX int) float64 {
func (Implementation) Dasum(n int, x []float64, incX int) float64 {
var sum float64
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if incX < 1 {
if incX == 0 {
@@ -135,9 +133,7 @@ func (Implementation) Idamax(n int, x []float64, incX int) int {
if n == 0 {
return -1 // Netlib returns invalid index when n == 0
}
- if n < 1 {
- panic(negativeN)
- }
+ panic(nLT0)
}
idx := 0
max := math.Abs(x[0])
@@ -177,7 +173,7 @@ func (Implementation) Dswap(n int, x []float64, incX int, y []float64, incY int)
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -219,7 +215,7 @@ func (Implementation) Dcopy(n int, x []float64, incX int, y []float64, incY int)
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -258,7 +254,7 @@ func (Implementation) Daxpy(n int, alpha float64, x []float64, incX int, y []flo
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -446,7 +442,7 @@ func (Implementation) Drot(n int, x []float64, incX int, y []float64, incY int,
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -490,7 +486,7 @@ func (Implementation) Drotm(n int, x []float64, incX int, y []float64, incY int,
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -601,7 +597,7 @@ func (Implementation) Dscal(n int, alpha float64, x []float64, incX int) {
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if alpha == 0 {
if incX == 1 {

MODIFY
blas/gonum/level1double_ddot.go
blas/gonum/level1double_ddot.go
@@ -21,7 +21,7 @@ func (Implementation) Ddot(n int, x []float64, incX int, y []float64, incY int)
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {

MODIFY
blas/gonum/level1single.go
blas/gonum/level1single.go
@@ -37,9 +37,7 @@ func (Implementation) Snrm2(n int, x []float32, incX int) float32 {
if n == 0 {
return 0
}
- if n < 1 {
- panic(negativeN)
- }
+ panic(nLT0)
}
var (
scale float32 = 0
@@ -97,7 +95,7 @@ func (Implementation) Snrm2(n int, x []float32, incX int) float32 {
func (Implementation) Sasum(n int, x []float32, incX int) float32 {
var sum float32
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if incX < 1 {
if incX == 0 {
@@ -143,9 +141,7 @@ func (Implementation) Isamax(n int, x []float32, incX int) int {
if n == 0 {
return -1 // Netlib returns invalid index when n == 0
}
- if n < 1 {
- panic(negativeN)
- }
+ panic(nLT0)
}
idx := 0
max := math.Abs(x[0])
@@ -187,7 +183,7 @@ func (Implementation) Sswap(n int, x []float32, incX int, y []float32, incY int)
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -231,7 +227,7 @@ func (Implementation) Scopy(n int, x []float32, incX int, y []float32, incY int)
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -272,7 +268,7 @@ func (Implementation) Saxpy(n int, alpha float32, x []float32, incX int, y []flo
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -466,7 +462,7 @@ func (Implementation) Srot(n int, x []float32, incX int, y []float32, incY int,
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -512,7 +508,7 @@ func (Implementation) Srotm(n int, x []float32, incX int, y []float32, incY int,
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
panic(badX)
@@ -625,7 +621,7 @@ func (Implementation) Sscal(n int, alpha float32, x []float32, incX int) {
if n == 0 {
return
}
- panic(negativeN)
+ panic(nLT0)
}
if alpha == 0 {
if incX == 1 {

MODIFY
blas/gonum/level1single_dsdot.go
blas/gonum/level1single_dsdot.go
@@ -25,7 +25,7 @@ func (Implementation) Dsdot(n int, x []float32, incX int, y []float32, incY int)
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {

MODIFY
blas/gonum/level1single_sdot.go
blas/gonum/level1single_sdot.go
@@ -25,7 +25,7 @@ func (Implementation) Sdot(n int, x []float32, incX int, y []float32, incY int)
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {

MODIFY
blas/gonum/level1single_sdsdot.go
blas/gonum/level1single_sdsdot.go
@@ -25,7 +25,7 @@ func (Implementation) Sdsdot(n int, alpha float32, x []float32, incX int, y []fl
if n == 0 {
return 0
}
- panic(negativeN)
+ panic(nLT0)
}
if incX == 1 && incY == 1 {
if len(x) < n {

MODIFY
blas/gonum/level2double.go
blas/gonum/level2double.go
@@ -120,7 +120,7 @@ func (Implementation) Dger(m, n int, alpha float64, x []float64, incX int, y []f
panic("m < 0")
}
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if incX == 0 {
panic(zeroIncX)
@@ -625,7 +625,7 @@ func (Implementation) Dsymv(ul blas.Uplo, n int, alpha float64, a []float64, lda
panic(badUplo)
}
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if lda > 1 && lda < n {
panic(badLdA)

MODIFY
blas/gonum/level2single.go
blas/gonum/level2single.go
@@ -126,7 +126,7 @@ func (Implementation) Sger(m, n int, alpha float32, x []float32, incX int, y []f
panic("m < 0")
}
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if incX == 0 {
panic(zeroIncX)
@@ -639,7 +639,7 @@ func (Implementation) Ssymv(ul blas.Uplo, n int, alpha float32, a []float32, lda
panic(badUplo)
}
if n < 0 {
- panic(negativeN)
+ panic(nLT0)
}
if lda > 1 && lda < n {
panic(badLdA)

blas/gonum: remove negativeN panic string

nLT0 serves the same purpose and fits with other similarly named
strings.