Yes it is for school.
It's in Java.
I could use a refreshing on what a matrix is and yes I've created a class before.
I don't know if it's supposed to return new or modify the matrix. What I posted is all I got.
Hi there are plenty of sites which explain matrices better than I can, but at the risk of confusing you:-
A matrix is basically a 2-dimensional array of numbers characterised by its numbers of rows and columns. You can also think of a matrix as a list of either row vectors or column vectors. For example, the matrix
0 1 2 3
4 5 6 7
8 9 0 1
can be thought of as the list of row vectors
[ [0 1 2 3], [4 5 6 7], [8 9 0 1] ]
or the list of column vectors
[ [0 4 8], [1 5 9], [2 6 0], [3 7 1] ]
When thinking through operations between matrices you might find the row/column interpretation easier to follow. For example, to multiply two matricies C = A*B, you multiple the row vectors of A by the column vectors of B. This puts the condition that the number of columns in A must equal the number of rows in B, and the resulting matrix C will have the property of the number of rows equal to the number of rows in A, and the number of columns will equal the number of columns of B.
When you come to implement your Matrix class though, it will be far easier to store the matrix as a 2-dimensional array of floats, rather than an array of row or column vectors. Also you'll need to save the dimensions of the matrix in your Matrix class. That way you will be able to check that the number of columns and rows in the operands make sense for the particular operation you are implementing, eg as in multiplication above.
My vote would be to have multiply, add etc return new matrices. This makes it far easier to write expressions which involve the same matrix more than once, eg if you wanted to calculate D = C *( C + B ).
b e n