Previous Page | Next Page

Further Notes

Efficiency

The Interactive Matrix Language is an interpretive language executor that can be characterized as follows:

  • efficient and inexpensive to compile

  • inefficient and expensive for the number of operations executed

  • efficient and inexpensive within each operation

Therefore, you should try to substitute matrix operations for iterative loops. There is a high overhead involved in executing each instruction; however, within the instruction IML runs very efficiently.

Consider the following four methods of summing the elements of a matrix:

   s = 0;                      /* method 1 */
   do i = 1 to m;
      do j = 1 to n;
         s = s + x[i,j];
      end;
   end;
   s = j[1,m] * x * j[n,1];    /* method 2 */
   s = x[+,+];                 /* method 3 */
   s = sum(x);                 /* method 4 */

Method 1 is the least efficient, method 2 is more efficient, method 3 is more efficient yet, and method 4 is the most efficient. The greatest advantage of using IML is reducing human programming labor.

Previous Page | Next Page | Top of Page