Matrix
From CometPublic
Comet support matrices (multi-dimentional arrays). The comet declaration
int m[1..10,10..100];
declares a 2-D matrix of integers with 10 rows and 91 columns. It can be accessed and modified as follows
m[2,5] = x; int y = m[2,5];
You may initialize the matrix with a default value
int m[1..10,10..100] = 1;
As with arrays matrices can also be populated at creation time if you know the dimension of the matrix
int m[1..2,1..2] = [[1,2],[3,4]];
A reference to entire matrix can be created and assigned as follow
int[,] w = m;
In the statement above, w and m are two aliases for the same matrix. Notice the use of the [,] notation next to w's type to indicate that w is a 2-D matrix of integers. All matrices are objects of the matrix type and therefore implement the following API
class matrix{T} {
void setName(string);
int arity();
int low(int);
int up(int);
int sz(int);
range rng(int);
}
The last four methods (low,up,sz,rng) take as an argument the dimension identifier that must range in 0..m.arity()-1.

