public Matrix<T, A> multiply(Matrix<T, A> right) throws MatrixException {
Matrix<T, A> temp = new Matrix<T, A>(arithmetics, rowSize, columnSize);
if (rowSize != right.columnSize)
throw new MatrixException(
"Cannot multiply matrices of different sizes");
for (int i = 0; i < rowSize; i++) {
for (int j = 0; j < right.columnSize ; j++)
for(int k = 0; k < right.rowSize ; k++)
temp.matrix[i][j] = arithmetics.add(temp.matrix[i][j],
(arithmetics.multiply(matrix[i][k], right.matrix[k][j])));
return temp;
}}
わかりましたので、2つの行列を乗算しようとしていますが、
Matrix1
0 0 1
1 1 1
Matrix5
1 2
2 4
3 6
私は答えを得る
Matrix1 multiply Matrix5
3 6 0
6 12 0
しかし、そうあるべきです
3 6
6 12
乗算を行列化するため