Hi,
Sorry for another thread. I'm trying to do matrix multiplication in Java now.
Here's my code (that wont work). Please let me know if you spot anything that I should change...
class multiply
{
public static void main(String[] args)
{
int[][] a = {{1,2,3}, {1,2,3}, {1,2,3}};
int[][] b = {{3,2,1}, {3,2,1}, {3,2,1}};
int[][] c = new double[3][3];
int i,j,k;
for (i = 0, i < 3; i++);
for (j = 0; j < 3; j++);
{
c[i][j] = 0.0;
for (k = 0; k < 3; k++)
{
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
}
System.out.println(“a.b = “+c[i][0]+” ”+c[i][1]+” ”+c[i][2]);
}
}