inner.praat 641 B

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