(noise float64, b *testing.B)
| 120 | var cp map[float64][]vg.Path |
| 121 | |
| 122 | func complexContourBench(noise float64, b *testing.B) { |
| 123 | rnd := rand.New(rand.NewPCG(1, 1)) |
| 124 | |
| 125 | data := make([]float64, 6400) |
| 126 | for i := range data { |
| 127 | r := float64(i/80) - 40 |
| 128 | c := float64(i%80) - 40 |
| 129 | |
| 130 | data[i] = rnd.NormFloat64()*noise + math.Hypot(r, c) |
| 131 | } |
| 132 | |
| 133 | m := unitGrid{mat.NewDense(80, 80, data)} |
| 134 | |
| 135 | levels := []float64{-1, 3, 7, 9, 13, 15, 19, 23, 27, 31} |
| 136 | |
| 137 | var p map[float64][]vg.Path |
| 138 | |
| 139 | b.ResetTimer() |
| 140 | for i := 0; i < b.N; i++ { |
| 141 | p = contourPaths(m, levels, unity, unity) |
| 142 | } |
| 143 | |
| 144 | cp = p |
| 145 | } |
| 146 | |
| 147 | func TestContourPaths(t *testing.T) { |
| 148 | m := unitGrid{mat.NewDense(3, 4, []float64{ |
no test coverage detected