gonum.org/v1/gonum@v0.14.0/blas/gonum/gonum.go (about) 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. 4 5 //go:generate ./single_precision.bash 6 7 package gonum 8 9 import ( 10 "math" 11 12 "gonum.org/v1/gonum/internal/math32" 13 ) 14 15 type Implementation struct{} 16 17 // [SD]gemm behavior constants. These are kept here to keep them out of the 18 // way during single precision code generation. 19 const ( 20 blockSize = 64 // b x b matrix 21 minParBlock = 4 // minimum number of blocks needed to go parallel 22 ) 23 24 func max(a, b int) int { 25 if a > b { 26 return a 27 } 28 return b 29 } 30 31 func min(a, b int) int { 32 if a > b { 33 return b 34 } 35 return a 36 } 37 38 // blocks returns the number of divisions of the dimension length with the given 39 // block size. 40 func blocks(dim, bsize int) int { 41 return (dim + bsize - 1) / bsize 42 } 43 44 // dcabs1 returns |real(z)|+|imag(z)|. 45 func dcabs1(z complex128) float64 { 46 return math.Abs(real(z)) + math.Abs(imag(z)) 47 } 48 49 // scabs1 returns |real(z)|+|imag(z)|. 50 func scabs1(z complex64) float32 { 51 return math32.Abs(real(z)) + math32.Abs(imag(z)) 52 }