Contents Previous Next Subchapters

Changing Matrix Indices
Syntax base variable(rowcolumn)
See Also rowbase , colbase , dim

Removed From Language
The base command was present in version 4 of O-Matrix but has been removed in version 5. If this command is used in version 5x, an error message to this effect is displayed. The old documentation for the base command is included below to aid in converting programs that use this command to run under version 5.

Description
Changes the index of the upper-left corner of variable to the specified row and column, where row and column are integer scalars.

Tutorial
The default base of a matrix is (1, 1). You can use the base statement to change the indices.

Entering
     x = {-6, -3, 0, 3, 6}
     base x(-2, 1)
     print x(-1), x(0), x(1)
O-Matrix will respond
     -3 0 3
because x(-2) corresponds to the first element of the column vector x.

Entering
     y = {[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]}
     base y(-1, -2)
     print y.row(0)
will result in
     [ 6 , 7 , 8 , 9 , 10 ]
If you continue the example above by entering
     print y.col(0)
O-Matrix will respond
     {
     3
     8
     13
     }
If you continue the example above by entering
     print y(0, 0)
O-Matrix will respond
     8