Help / Release / J 5.03 / (+/ % #)\ Improved

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



(+/ % #)\ Improved

initial writing: 2003-11-10
last updated: 2003-12-04


The dyad (+/ % #)\ computes the moving average and is now implemented by special code for positive left arguments and integer and floating point right arguments. The following table illustrates the improvements in time and space.

x=: 0.01*?n$1000
ts=: 6!:2 , 7!:2@]  NB. time and space
ts 'm (+/ % #)\x'
m    n    J 5.03   J 5.02   Ratio
50 1e5  0.010857  1.051264e6  0.428732  3.148352e6  39.49 2.99
50 2e5  0.0216862.099840e6  0.8559406.294080e6  39.47 3.00
50 4e5  0.0477964.196992e6  1.6936981.258554e7  35.44 3.00
50 8e5  0.0971448.391296e6  3.4081512.516845e7  35.08 3.00
100 1e5  0.0112511.051264e6  0.4675023.148864e6  41.55 3.00
100 2e5  0.0229392.099840e6  0.9208476.294592e6  40.14 3.00
100 4e5  0.0445954.196992e6  1.8439811.258605e7  41.35 3.00
100 8e5  0.0920178.391296e6  3.6807612.516896e7  40.00 3.00
200 1e5  0.0114481.051264e6  0.6258743.149888e6  54.67 3.00
200 2e5  0.0223402.099840e6  1.2554976.295616e6  56.20 3.00
200 4e5  0.0450644.196992e6  2.5048651.258707e7  55.58 3.00
200 8e5  0.0891578.391296e6  5.0230582.516998e7  56.34 3.00
400 1e5  0.0110271.051264e6  0.7767913.151936e6  70.45 3.00
400 2e5  0.0224622.099840e6  1.5652286.297664e6  69.68 3.00
400 4e5  0.0478614.196992e6  3.1243041.258912e7  65.28 3.00
400 8e5  0.0910998.391296e6  6.2751702.517203e7  68.88 3.00



>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release