github.com/gopherd/gonum@v0.0.4/blas/testblas/dtrmvbench.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 package testblas 6 7 import ( 8 "testing" 9 10 "math/rand" 11 12 "github.com/gopherd/gonum/blas" 13 ) 14 15 func DtrmvBenchmark(b *testing.B, dtrmv Dtrmver, n, lda, incX int, ul blas.Uplo, tA blas.Transpose, d blas.Diag) { 16 rnd := rand.New(rand.NewSource(0)) 17 a := make([]float64, n*lda) 18 for i := range a { 19 a[i] = rnd.Float64() 20 } 21 22 x := make([]float64, n*incX) 23 for i := range x { 24 x[i] = rnd.Float64() 25 } 26 27 b.ResetTimer() 28 for i := 0; i < b.N; i++ { 29 dtrmv.Dtrmv(ul, tA, d, n, a, lda, x, incX) 30 } 31 }