BenchmarkNewFromElements benchmarks the NewFromElements function.
(b *testing.B)
| 185 | |
| 186 | // BenchmarkNewFromElements benchmarks the NewFromElements function. |
| 187 | func BenchmarkNewFromElements(b *testing.B) { |
| 188 | // Create a sample matrix for benchmarking |
| 189 | rows := 100 |
| 190 | columns := 100 |
| 191 | elements := make([][]int, rows) |
| 192 | for i := range elements { |
| 193 | elements[i] = make([]int, columns) |
| 194 | for j := range elements[i] { |
| 195 | elements[i][j] = i*columns + j // Some arbitrary values |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | for i := 0; i < b.N; i++ { |
| 200 | _, _ = matrix.NewFromElements(elements) |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // BenchmarkGet benchmarks the Get method. |
| 205 | func BenchmarkGet(b *testing.B) { |
nothing calls this directly
no test coverage detected