•
|
The matrix concatenation operators, || and |/, add columns or rows to a matrix dynamically. However, the script runs faster if you define a matrix in a static fashion instead.
|
t1 = Tick Seconds();
For( i = 1, i <= 10000, i++,
A[0, i] = a2;
t2 = Tick Seconds();
Show( t2 - t1 );
t3 = Tick Seconds();
For( i = 1, i <= 10000, i++,
t4 = Tick Seconds();
Show( t4 - t3 );
•
|
If you know the size of a matrix that you're going to need, it’s typically better to allocate the matrix in its entirety first and then populate it. In the example below, the J() function is doing the allocation of the 100000x1 matrix all at the same time.
|
Delete Symbols( a1, a2 );
t1 = Tick Seconds();
t2 = Tick Seconds();
Show( t2 - t1 );
Delete Symbols( a1 );
t3 = Tick Seconds();
a2 |/= Random Uniform()
t4 = Tick Seconds();
Show( t4 - t3 );