| 1 |
writeInfoLine: "inner..." |
| 2 |
|
| 3 |
assert inner(linear#(1,100,100,0),linear#(1,100,100,0)) = 338350 |
| 4 |
assert inner(linear#(1,100,100,0),1000000+linear#(1,100,100,0)) = 5050338350 |
| 5 |
|
| 6 |
for size from 1 to 100 |
| 7 |
x# = linear# (1, size, size, 0) |
| 8 |
y# = 1000000 + x# |
| 9 |
assert inner (x#, y#) = sumOver (i to size, x# [i] * y# [i]) ; 'i' |
| 10 |
endfor |
| 11 |
|
| 12 |
durations# = zero# (100) |
| 13 |
for n from 1 to 100 |
| 14 |
result$ = Praat test: "TimeInner", string$ (10^8 / n), string$ (n), "", "" |
| 15 |
durations# [n] = extractNumber (result$, newline$) |
| 16 |
appendInfoLine (n, " ", durations# [n]) |
| 17 |
endfor |
| 18 |
|
| 19 |
appendInfoLine: "mean ", mean (durations#), " nanoseconds" |
| 20 |
|
| 21 |
;for n to 1000 |
| 22 |
appendInfoLine: "OK" |