Chief Ray

Photogrammetric and Mapping Software


 

Input arrays

The functions in RayTools for Excel accept two different types of array arguments as inputs: rectangular Excel ranges, and array constants.

Rectangular Excel ranges can either be 2-dimensional or 1-dimensional. A 2-dimensional range such as A1:C3 holds a matrix, and a 1-dimensional range such as A1:A5 holds a vector. RayTools makes no distinction between column vectors and row vectors—the values in the range are just assigned to the vector elements in left-to-right or top-to-bottom order, as appropriate.

Array constants are lists of numbers, separated by commas, that are entered in the formula bar. Lists begin with { and end with }. If the array is 2-dimensional, the numbers are assigned row-wise to array elements with semicolons separating the rows. For example, a formula that computes the norm of a specific 4x4 matrix might be entered in the formula bar as =matnorm({1,9,8,3;2,3,6,1;5,4,3,7;4,1,2,3}) . The corresponding formula to compute the norm of the 4-vector in the the first column of the same matrix might be entered as =vnorm(1,2,5,4) .

Output array

RayTools uses array formulas to compute an output array and load it into a rectangular range. To enter an array formula, an output range must first be selected. Then the formula is entered into the formula bar followed by Ctrl-Shift-Enter. Of course, an array constants cannot be used to hold the output of an array formula.

Similar to an input range, the output range may be 2-dimensional for a matrix, or 1-dimensional for a vector.  An output vector range may either be a horizontal column range or a vertical row range, depending on the shape of the range selected by the user.

Example

RayTools for Excel allows a vector of any length, including a 3-vector, quaternion, or general n-vector, to be expressed either as a vertical or a horizontal range. (A quaternion is expressed as a vector of length 4,  with the first element holding the scalar portion.) For example, the sheet below has quaternions  in the column range B1:B4 and row range D2:G2.

  A B C D E F G
1   3          
2   2   1.7 2.8

3.6

5.2
3   2.5          
4   5.72          
5              
6              
7              

The quaternion in B1:B4 has a 3 as its scalar portion, and (2, 2.5, 5.72) as its vector portion.

Now, say that we want to multiply these two quaternions together and place the result in the row range C6:F6. To multiply quaternions, we use the RayTools function QMULT as follows:

  1. Select the horizontal destination range C6:F6 with the cursor.
  2. Click n the formula bar, and enter the formula "=QMULT(B1:B4, D2:G2)" . This can be done in any of the usual Excel ways, such as by typing the entire formula, or by typing the function name and using the cursor to select the input ranges, or by using the Insert | Function menu sequence and selecting QMULT from the User Defined category.
  3. Enter Ctrl-Shift-Enter simultaneously to enter the array formula.

Excel multiplies the quaternions and places the product in the highlighted destination range.

  A B C D E F G
1   3          
2   2   1.7 2.8 3.6 5.2
3   2.5          
4   5.72          
5              
6     -39.244 4.208 20.7 25.524  
7              

The same result could have been placed into a vertical column range by selecting a vertical destination range in step 1.

Tips

  • To delete an array formula, select the entire output vector and press the Delete key. If Excel complains to you that "You cannot change part of an array," it is because you either selected only part of the output vector.
  • If Excel seems to get confused with the way you are deleting a range, just press the Esc key and try again.

 

For more information, contact Chief Ray .

 

Return to home page.