For the latest version of JMP Help, visit JMP.com/help.

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.
// Faster example
t1 = Tick Seconds();
A = J( 10, 10000, . );
For( i = 1, i <= 10000, i++,
	a2 = J( 10, 1, Random Gamma( 1, 1 ) );
	// define a2 to be a 10 by 1 vector of random 	gamma values.
       A[0, i] = a2;
      /* populate the ith column of the matrix A to have the
	  		values in a2.  The first argument, 0, means "all rows". */
);
t2 = Tick Seconds();
Show( t2 - t1 );
t2 - t1 = 0.0166666666627862;
 
// Slower example
t3 = Tick Seconds();
B = J( 10, 0, . );
For( i = 1, i <= 10000, i++,
	a2 = J( 10, 1, Random Gamma( 1, 1 ) );
	B = B || a2;
);
t4 = Tick Seconds();
Show( t4 - t3 );
t4 - t3 = 3.1333333333605;
Delete Symbols( a1, a2 );
// Faster example
t1 = Tick Seconds();
a1 = J( 100000, 1, Random Uniform() );
t2 = Tick Seconds();
Show( t2 - t1 );
Delete Symbols( a1 );
t2 - t1 = 0;
 
// Slower example
t3 = Tick Seconds();
a2 = J( 0, 0 );
For( i = 1, i <= 100000, i++,
	a2 |/= Random Uniform()
);
t4 = Tick Seconds();
Show( t4 - t3 );
t4 - t3 = 5.05000000004657;

Help created on 3/19/2020