/*
 * MatrixMultiplyMaster.java -- The master of MatrixMultiplySlave threads.
 */

class MatrixMultiplyMaster {
    public static double matrix_multiply_trace( double a[][], double b[][],
						double c[][], int nthreads )
	throws java.lang.InterruptedException
    {
	int i;
	MatrixMultiplySlave slaves[] = new MatrixMultiplySlave[nthreads];
	for( i=0; i<nthreads; i++ )
	{
	    slaves[i] = new MatrixMultiplySlave( a,b,c,i,nthreads );
	    slaves[i].start();
	}
	double trace = 0.0;
	for( i=0; i<nthreads; i++ )
	{
	    slaves[i].join();
	    trace += slaves[i].get_trace();
	}
	return( trace );
    }
}
