Forum Discussion
Alternative formulas for expanding a column of row thunks.
- May 08, 2022
Second variant is much faster. 200x90 array
Second variant gives approximately the same time on 1400x900 array
I tested on =SEQUENCE( n, m ) array and on slow PC.
First variant works on per-element basis, second one with arrays loaded into memory as one object. My guess.
Because I have doubts about the efficiency of forming and then expanding thunk arrays, I have tried to reformulate an accumulation problem so that the 2D results array grows throughout the calculation, by using REDUCE and HSTACK. I have yet to perform any timing runs to see whether the problem of O(n²) calculation time is reduced.
The other characteristic of the test problems that may well confuse, is that the Lambda functions that perform the core calculation are passed into the formula as a parameter. Radically different calculations can thus be conducted within the same formula/code framework.
To date, most of my effort has been committed to "Will this work?". "Will it work efficiently as the problem size grows?" is entirely another matter.