I posted some array routines for calculating the sum, the average and the variance of the numbers in an array.
The routine for calculating the variance of the numbers in an array used standard "For‥Next" loops. It is possible to re-write that routine to just use Array operations. For example to calculate the deviations from the mean one could write:
C() = testArray() - Mean
And to calculate the squared deviations one could write:
D() = C() * C()
I wondered about the relative speed of the array operations compared with For ‥ Next loops and also about memory usage. If one has fairly large data sets array operations could perhaps consume a great deal of memory?
Those array operations look like they will work. It is always better to use array operations than for…next loops. Array operations do take up more memory, but Basic will tell you when you run out. All the memory gets recycled.
If there are generalized array functions that you would like to see as built in functions just let me know. Anything you think other people might use. I think all these types of functions should start with Mat as in:
s() = MatSum(a())
These types of functions will always execute much faster than using Basic and for…next loops.