gonum.org/v1/gonum@v0.15.1-0.20240517103525-f853624cb1bb/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 // blocks returns the number of divisions of the dimension length with the given 25 // block size. 26 func blocks(dim, bsize int) int { 27 return (dim + bsize - 1) / bsize 28 } 29 30 // dcabs1 returns |real(z)|+|imag(z)|. 31 func dcabs1(z complex128) float64 { 32 return math.Abs(real(z)) + math.Abs(imag(z)) 33 } 34 35 // scabs1 returns |real(z)|+|imag(z)|. 36 func scabs1(z complex64) float32 { 37 return math32.Abs(real(z)) + math32.Abs(imag(z)) 38 }