- import java.util.*;
- public class Matrix implements Runnable
- {
- int n;
- double[][] a, b, c;
- Matrix(int nn,double[][] aa, double[][] bb, double[][] cc)
- {
- n = nn;
- a = aa;
- b = bb;
- c = cc;
- }
- public static void multiplication(int n,double[][] a, double[][] b, double[][] c)
- {
- Thread t = new Thread(new Matrix(n, a, b, c));
- t.start();
- while(n!=-1){}
- }
- public void run()
- {
- int i,j,k;
- double t1,t2,a_tmp[],b_tmp[],c_tmp[];
- for(i=0;i<n;i++)
- for(j=i+1;j<n;j++)
- {
- t1=b[i][j];
- b[i][j]=b[j][i];
- b[j][i]=t1;
- }
- for(i=0;i<n;i++)
- {
- c_tmp=c[i];
- a_tmp=a[i];
- for(j=0;j<n;j++)
- {
- b_tmp=b[j];
- t1=0;
- for(k=0;k<n;k++)
- {
- t1+=a_tmp[k]*b_tmp[k];
- }
- c_tmp[j]=t1;
- }
- }
- n=-1;
- }
- }
Raw Paste