Hi I have this code for multiplication of matrices in Java. It is working (no errors) but giving me wrong answer of the multiplied matrix. The two matrices which are to be multiplied have been defined properly. Here's the code:
// position_new = multiply ( transformation (3x3) * transpose(3x1) )
int rows=3, columns=1;
double multiply[][] = new double[rows][columns];
double sum;
for (int k = 0; k < columns; k++) {
for (int e = 0; e < rows; e++) {
sum = 0;
for (int f = 0; f < columns; f++) {
sum = sum + transformation[e][f] * transpose[f][k];
}
multiply[e][k] = sum;
}
}
System.out.println("Multiplied Matrix:-");
for (int m = 0; m < rows; m++) {
for (int n = 0; n < columns; n++)
System.out.print(multiply[m][n] + "\t");
System.out.print("\n");
}
Thanks a lot for the help in advance.