gonum.org/v1/gonum@v0.14.0/blas/gonum/dtrmvbench_test.go (about)

     1  // Copyright ©2017 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 gonum
     6  
     7  import (
     8  	"strconv"
     9  	"testing"
    10  
    11  	"gonum.org/v1/gonum/blas"
    12  	"gonum.org/v1/gonum/blas/testblas"
    13  )
    14  
    15  func BenchmarkDtrmv(b *testing.B) {
    16  	for _, n := range []int{testblas.MediumMat, testblas.LargeMat} {
    17  		for _, incX := range []int{1, 5} {
    18  			for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
    19  				for _, trans := range []blas.Transpose{blas.NoTrans, blas.Trans} {
    20  					for _, unit := range []blas.Diag{blas.NonUnit, blas.Unit} {
    21  						var str string
    22  						if n == testblas.MediumMat {
    23  							str += "Med"
    24  						} else if n == testblas.LargeMat {
    25  							str += "Large"
    26  						}
    27  						str += "_Inc" + strconv.Itoa(incX)
    28  						if uplo == blas.Upper {
    29  							str += "_UP"
    30  						} else {
    31  							str += "_LO"
    32  						}
    33  						if trans == blas.NoTrans {
    34  							str += "_NT"
    35  						} else {
    36  							str += "_TR"
    37  						}
    38  						if unit == blas.NonUnit {
    39  							str += "_NU"
    40  						} else {
    41  							str += "_UN"
    42  						}
    43  						lda := n
    44  						b.Run(str, func(b *testing.B) {
    45  							testblas.DtrmvBenchmark(b, Implementation{}, n, lda, incX, uplo, trans, unit)
    46  						})
    47  					}
    48  				}
    49  			}
    50  		}
    51  	}
    52  }