1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 //go:generate ./single_precision.bash
11 type Implementation struct{}
13 // The following are panic strings used during parameter checks.
15 negativeN = "blas: n < 0"
16 zeroIncX = "blas: zero x index increment"
17 zeroIncY = "blas: zero y index increment"
18 badLenX = "blas: x index out of range"
19 badLenY = "blas: y index out of range"
24 kLLT0 = "blas: kL < 0"
25 kULT0 = "blas: kU < 0"
27 badUplo = "blas: illegal triangle"
28 badTranspose = "blas: illegal transpose"
29 badDiag = "blas: illegal diagonal"
30 badSide = "blas: illegal side"
32 badLdA = "blas: index of a out of range"
33 badLdB = "blas: index of b out of range"
34 badLdC = "blas: index of c out of range"
36 badX = "blas: x index out of range"
37 badY = "blas: y index out of range"
40 // [SD]gemm behavior constants. These are kept here to keep them out of the
41 // way during single precision code genration.
43 blockSize = 64 // b x b matrix
44 minParBlock = 4 // minimum number of blocks needed to go parallel
45 buffMul = 4 // how big is the buffer relative to the number of workers
48 // subMul is a common type shared by [SD]gemm.
50 i, j int // index of block
53 func max(a, b int) int {
60 func min(a, b int) int {
67 func checkSMatrix(name byte, m, n int, a []float32, lda int) {
75 panic("blas: illegal stride of " + string(name))
77 if len(a) < (m-1)*lda+n {
78 panic("blas: index of " + string(name) + " out of range")
82 func checkDMatrix(name byte, m, n int, a []float64, lda int) {
90 panic("blas: illegal stride of " + string(name))
92 if len(a) < (m-1)*lda+n {
93 panic("blas: index of " + string(name) + " out of range")
97 func checkZMatrix(name byte, m, n int, a []complex128, lda int) {
105 panic("blas: illegal stride of " + string(name))
107 if len(a) < (m-1)*lda+n {
108 panic("blas: insufficient " + string(name) + " matrix slice length")
112 func checkZVector(name byte, n int, x []complex128, incX int) {
119 if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
120 panic("blas: insufficient " + string(name) + " vector slice length")
124 // blocks returns the number of divisions of the dimension length with the given
126 func blocks(dim, bsize int) int {
127 return (dim + bsize - 1) / bsize
130 // dcabs1 returns |real(z)|+|imag(z)|.
131 func dcabs1(z complex128) float64 {
132 return math.Abs(real(z)) + math.Abs(imag(z))