OSDN Git Service

test (#52)
[bytom/vapor.git] / vendor / gonum.org / v1 / gonum / blas / gonum / level1cmplx128_bench_test.go
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         "testing"
9
10         "golang.org/x/exp/rand"
11 )
12
13 func benchmarkZdscal(b *testing.B, n, inc int) {
14         rnd := rand.New(rand.NewSource(1))
15         alpha := rnd.NormFloat64()
16         x := make([]complex128, (n-1)*inc+1)
17         for i := range x {
18                 x[i] = complex(rnd.NormFloat64(), rnd.NormFloat64())
19         }
20         b.ResetTimer()
21         for i := 0; i < b.N; i++ {
22                 impl.Zdscal(n, alpha, x, inc)
23         }
24 }
25
26 func BenchmarkZdscalN10Inc1(b *testing.B)     { benchmarkZdscal(b, 10, 1) }
27 func BenchmarkZdscalN100Inc1(b *testing.B)    { benchmarkZdscal(b, 100, 1) }
28 func BenchmarkZdscalN1000Inc1(b *testing.B)   { benchmarkZdscal(b, 1000, 1) }
29 func BenchmarkZdscalN10000Inc1(b *testing.B)  { benchmarkZdscal(b, 10000, 1) }
30 func BenchmarkZdscalN100000Inc1(b *testing.B) { benchmarkZdscal(b, 100000, 1) }
31
32 func BenchmarkZdscalN10Inc10(b *testing.B)     { benchmarkZdscal(b, 10, 10) }
33 func BenchmarkZdscalN100Inc10(b *testing.B)    { benchmarkZdscal(b, 100, 10) }
34 func BenchmarkZdscalN1000Inc10(b *testing.B)   { benchmarkZdscal(b, 1000, 10) }
35 func BenchmarkZdscalN10000Inc10(b *testing.B)  { benchmarkZdscal(b, 10000, 10) }
36 func BenchmarkZdscalN100000Inc10(b *testing.B) { benchmarkZdscal(b, 100000, 10) }
37
38 func BenchmarkZdscalN10Inc1000(b *testing.B)     { benchmarkZdscal(b, 10, 1000) }
39 func BenchmarkZdscalN100Inc1000(b *testing.B)    { benchmarkZdscal(b, 100, 1000) }
40 func BenchmarkZdscalN1000Inc1000(b *testing.B)   { benchmarkZdscal(b, 1000, 1000) }
41 func BenchmarkZdscalN10000Inc1000(b *testing.B)  { benchmarkZdscal(b, 10000, 1000) }
42 func BenchmarkZdscalN100000Inc1000(b *testing.B) { benchmarkZdscal(b, 100000, 1000) }