You can browse it online at cobra/trunk/Supplements/Matrix.cobra.

Here is some of the test code for it:

`m = Matrix<of int>(3, 7)`

assert m.count == 21

for x in 3, for y in 7, m[x, y] = x*y

for x in 3, for y in 7, assert m[x, y] == x*y

expect IndexOutOfRangeException, print m[3, 7]

expect IndexOutOfRangeException, print m[3, 0]

expect IndexOutOfRangeException, print m[0, 7]

expect IndexOutOfRangeException, print m[4, 8]

d1, d2, d3 = 10, 5, 3

m = Matrix<of int>(d1, d2, d3)

assert m.count == d1 * d2 * d3

for x in d1, for y in d2, for z in d3, m[x, y, z] = x*y*z

for x in d1, for y in d2, for z in d3, assert m[x, y, z] == x*y*z

dims = [d1, d2, d3]

m2 = Matrix<of int>(dims)

for x in d1, for y in d2, for z in d3, m2[x, y, z] = x*y*z

for x in d1, for y in d2, for z in d3, assert m2[x, y, z] == x*y*z

assert m2 == m

m2[0, 0, 0] += 1

assert m2 <> m

You can also pass in a list of dimensions where the list size and its values are not determined until run-time.

You can subclass Matrix<of T> to add more methods relevant to your purposes, or even hack up the existing version as you see fit.