14

 

 

Calling C

 

Both R and MATLAB can perform vectorized computations, where iteration over the elements of a vector or matrix is performed implicitly, i.e., internally. This is much more efficient than writing explicit “for” loops, which run very slowly due to both platforms being interpreted (rather than compiled) languages. For some computations, however, explicit iteration is required. This occurs when each stage of a computation depends on the results of the previous stage. The following two examples of such computations will be used for demonstration purposes here.

  1. The Fisher Yates shuffle [8] for permuting a set of n values in a vector v; here we consider a more recent version, sometimes known as the Knuth shuffle [6, 15], which is ...

Get R and MATLAB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.