github.com/gopherd/gonum@v0.0.4/blas/gonum/single_precision.bash (about) 1 #!/usr/bin/env bash 2 3 # Copyright ©2015 The Gonum Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style 5 # license that can be found in the LICENSE file. 6 7 WARNINGF32='//\ 8 // Float32 implementations are autogenerated and not directly tested.\ 9 ' 10 WARNINGC64='//\ 11 // Complex64 implementations are autogenerated and not directly tested.\ 12 ' 13 14 # Level1 routines. 15 16 echo Generating level1float32.go 17 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32.go 18 cat level1float64.go \ 19 | gofmt -r 'blas.Float64Level1 -> blas.Float32Level1' \ 20 \ 21 | gofmt -r 'float64 -> float32' \ 22 | gofmt -r 'blas.DrotmParams -> blas.SrotmParams' \ 23 \ 24 | gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \ 25 | gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \ 26 | gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \ 27 | gofmt -r 'f64.L2NormInc -> f32.L2NormInc' \ 28 | gofmt -r 'f64.L2NormUnitary -> f32.L2NormUnitary' \ 29 | gofmt -r 'f64.ScalInc -> f32.ScalInc' \ 30 | gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \ 31 \ 32 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \ 33 -e 's_^// D_// S_' \ 34 -e "s_^\(func (Implementation) \)Id\(.*\)\$_$WARNINGF32\1Is\2_" \ 35 -e 's_^// Id_// Is_' \ 36 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 37 -e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \ 38 -e 's_safmin = 0x1p-1022_safmin = 0x1p-126_' \ 39 >> level1float32.go 40 41 echo Generating level1cmplx64.go 42 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1cmplx64.go 43 cat level1cmplx128.go \ 44 | gofmt -r 'blas.Complex128Level1 -> blas.Complex64Level1' \ 45 \ 46 | gofmt -r 'float64 -> float32' \ 47 | gofmt -r 'complex128 -> complex64' \ 48 \ 49 | gofmt -r 'c128.AxpyInc -> c64.AxpyInc' \ 50 | gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \ 51 | gofmt -r 'c128.DotcInc -> c64.DotcInc' \ 52 | gofmt -r 'c128.DotcUnitary -> c64.DotcUnitary' \ 53 | gofmt -r 'c128.DotuInc -> c64.DotuInc' \ 54 | gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \ 55 | gofmt -r 'c128.ScalInc -> c64.ScalInc' \ 56 | gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \ 57 | gofmt -r 'dcabs1 -> scabs1' \ 58 \ 59 | sed -e "s_^\(func (Implementation) \)Zdot\(.*\)\$_$WARNINGC64\1Cdot\2_" \ 60 -e 's_^// Zdot_// Cdot_' \ 61 -e "s_^\(func (Implementation) \)Zdscal\(.*\)\$_$WARNINGC64\1Csscal\2_" \ 62 -e 's_^// Zdscal_// Csscal_' \ 63 -e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \ 64 -e 's_^// Z_// C_' \ 65 -e "s_^\(func (Implementation) \)Iz\(.*\)\$_$WARNINGC64\1Ic\2_" \ 66 -e 's_^// Iz_// Ic_' \ 67 -e "s_^\(func (Implementation) \)Dz\(.*\)\$_$WARNINGC64\1Sc\2_" \ 68 -e 's_^// Dz_// Sc_' \ 69 -e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \ 70 -e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \ 71 >> level1cmplx64.go 72 73 echo Generating level1float32_sdot.go 74 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_sdot.go 75 cat level1float64_ddot.go \ 76 | gofmt -r 'float64 -> float32' \ 77 \ 78 | gofmt -r 'f64.DotInc -> f32.DotInc' \ 79 | gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \ 80 \ 81 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \ 82 -e 's_^// D_// S_' \ 83 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 84 >> level1float32_sdot.go 85 86 echo Generating level1float32_dsdot.go 87 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_dsdot.go 88 cat level1float64_ddot.go \ 89 | gofmt -r '[]float64 -> []float32' \ 90 \ 91 | gofmt -r 'f64.DotInc -> f32.DdotInc' \ 92 | gofmt -r 'f64.DotUnitary -> f32.DdotUnitary' \ 93 \ 94 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1Ds\2_" \ 95 -e 's_^// D_// Ds_' \ 96 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 97 >> level1float32_dsdot.go 98 99 echo Generating level1float32_sdsdot.go 100 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_sdsdot.go 101 cat level1float64_ddot.go \ 102 | gofmt -r 'float64 -> float32' \ 103 \ 104 | gofmt -r 'f64.DotInc(x, y, f(n), f(incX), f(incY), f(ix), f(iy)) -> alpha + float32(f32.DdotInc(x, y, f(n), f(incX), f(incY), f(ix), f(iy)))' \ 105 | gofmt -r 'f64.DotUnitary(a, b) -> alpha + float32(f32.DdotUnitary(a, b))' \ 106 \ 107 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1Sds\2_" \ 108 -e 's_^// D\(.*\)$_// Sds\1 plus a constant_' \ 109 -e 's_\\sum_alpha + \\sum_' \ 110 -e 's/n int/n int, alpha float32/' \ 111 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 112 >> level1float32_sdsdot.go 113 114 115 # Level2 routines. 116 117 echo Generating level2float32.go 118 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level2float32.go 119 cat level2float64.go \ 120 | gofmt -r 'blas.Float64Level2 -> blas.Float32Level2' \ 121 \ 122 | gofmt -r 'float64 -> float32' \ 123 \ 124 | gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \ 125 | gofmt -r 'f64.AxpyIncTo -> f32.AxpyIncTo' \ 126 | gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \ 127 | gofmt -r 'f64.AxpyUnitaryTo -> f32.AxpyUnitaryTo' \ 128 | gofmt -r 'f64.DotInc -> f32.DotInc' \ 129 | gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \ 130 | gofmt -r 'f64.ScalInc -> f32.ScalInc' \ 131 | gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \ 132 | gofmt -r 'f64.Ger -> f32.Ger' \ 133 | gofmt -r 'f64.GemvN -> f32.GemvN' \ 134 | gofmt -r 'f64.GemvT -> f32.GemvT' \ 135 | gofmt -r 'Implementation{}.Dscal -> Implementation{}.Sscal' \ 136 \ 137 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \ 138 -e 's_^// D_// S_' \ 139 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 140 >> level2float32.go 141 142 echo Generating level2cmplx64.go 143 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level2cmplx64.go 144 cat level2cmplx128.go \ 145 | gofmt -r 'blas.Complex128Level2 -> blas.Complex64Level2' \ 146 \ 147 | gofmt -r 'complex128 -> complex64' \ 148 | gofmt -r 'float64 -> float32' \ 149 \ 150 | gofmt -r 'c128.AxpyInc -> c64.AxpyInc' \ 151 | gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \ 152 | gofmt -r 'c128.DotuInc -> c64.DotuInc' \ 153 | gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \ 154 | gofmt -r 'c128.ScalInc -> c64.ScalInc' \ 155 | gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \ 156 \ 157 | sed -e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \ 158 -e 's_^// Z_// C_' \ 159 -e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \ 160 -e 's_"math/cmplx"_cmplx "gonum.org/v1/gonum/internal/cmplx64"_' \ 161 >> level2cmplx64.go 162 163 # Level3 routines. 164 165 echo Generating level3float32.go 166 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level3float32.go 167 cat level3float64.go \ 168 | gofmt -r 'blas.Float64Level3 -> blas.Float32Level3' \ 169 \ 170 | gofmt -r 'float64 -> float32' \ 171 \ 172 | gofmt -r 'f64.AxpyUnitaryTo -> f32.AxpyUnitaryTo' \ 173 | gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \ 174 | gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \ 175 | gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \ 176 \ 177 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \ 178 -e 's_^// D_// S_' \ 179 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 180 >> level3float32.go 181 182 echo Generating sgemm.go 183 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > sgemm.go 184 cat dgemm.go \ 185 | gofmt -r 'float64 -> float32' \ 186 | gofmt -r 'sliceView64 -> sliceView32' \ 187 \ 188 | gofmt -r 'dgemmParallel -> sgemmParallel' \ 189 | gofmt -r 'computeNumBlocks64 -> computeNumBlocks32' \ 190 | gofmt -r 'dgemmSerial -> sgemmSerial' \ 191 | gofmt -r 'dgemmSerialNotNot -> sgemmSerialNotNot' \ 192 | gofmt -r 'dgemmSerialTransNot -> sgemmSerialTransNot' \ 193 | gofmt -r 'dgemmSerialNotTrans -> sgemmSerialNotTrans' \ 194 | gofmt -r 'dgemmSerialTransTrans -> sgemmSerialTransTrans' \ 195 \ 196 | gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \ 197 | gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \ 198 | gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \ 199 \ 200 | sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \ 201 -e 's_^// D_// S_' \ 202 -e 's_^// d_// s_' \ 203 -e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \ 204 >> sgemm.go 205 206 echo Generating level3cmplx64.go 207 echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level3cmplx64.go 208 cat level3cmplx128.go \ 209 | gofmt -r 'blas.Complex128Level3 -> blas.Complex64Level3' \ 210 \ 211 | gofmt -r 'float64 -> float32' \ 212 | gofmt -r 'complex128 -> complex64' \ 213 \ 214 | gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \ 215 | gofmt -r 'c128.DscalUnitary -> c64.SscalUnitary' \ 216 | gofmt -r 'c128.DotcUnitary -> c64.DotcUnitary' \ 217 | gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \ 218 | gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \ 219 \ 220 | sed -e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \ 221 -e 's_^// Z_// C_' \ 222 -e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \ 223 -e 's_"math/cmplx"_cmplx "gonum.org/v1/gonum/internal/cmplx64"_' \ 224 >> level3cmplx64.go