ArrayFire is a fantastic library when it comes to speed and performance. One of the things that people overlook when evaluating ArrayFire is the indexing options available to the user.

The ArrayFire library exposes the array data structure to the user. The array stores the data in a column major order. This means that the following code:

<pre>
float[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9};
array A(3, 3, a);
</pre>

Will produce the following matrix:

<a href="http://sandbox.arrayfire.com/wp-content/uploads/2014/06/CodeCogsEqn.gif"><img src="http://sandbox.arrayfire.com/wp-content/uploads/2014/06/CodeCogsEqn.gif" alt="3x3 Column Major Matrix" width="72" height="67" class="alignnone size-full wp-image-5986" /></a>

Notice how the first three values make up the first column.

When you want to perform an operation on every element of the array you can just use the variable name with the operation. The following command performs adds 5 to each element of the array:

<pre>
A += 5;
</pre>

Sometimes you only want to perform a calculation on a part of the data. In this case you can index into the elements of the matrix using the parenthesis notation. For example, you can access the middle element of the initial array by using:

<pre>
float[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9};
array A(3, 3, a);
A(1, 1); // == 5
</pre>

The first number in the parenthesis is the column index, and the second number is the row index. The 