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.
10 "golang.org/x/exp/rand"
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)
18 x[i] = complex(rnd.NormFloat64(), rnd.NormFloat64())
21 for i := 0; i < b.N; i++ {
22 impl.Zdscal(n, alpha, x, inc)
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) }
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) }
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) }