
- •Explanation note
- •Introduction
- •1.Analyzing of given task.
- •1.1.Creation of system if equations.
- •1.2 Topological analyze: definition of branches of tree and antitree, definition of matrixes
- •1.3 Modifying of given system of equations to type, this can be calculated by eller method
- •Inverting of matrixes.
- •2. Developing of serial calculating of given task
- •2.Developing of parallel program for calculating of given task
- •3.1 Prior analysis of possible paralleling variants
- •Virtual speed and efficiency of resource use
- •3.2 Development of parallel program
- •Int mpi_Init(int *argc, char ***argv)
- •Int mpi_Barrier (mpi_Comm comm)
- •Conclusion
- •References
Inverting of matrixes.
It is hardest operation and we can use algorithm from Joahna mathematics library:
INT i,j,k;
for (INT i = 0;i<n;i++)
for(j = 0;j<n;j++)
Y[i][j] = X[i][j];
/* Locations of pivot elements */
INT pvt_i[7], pvt_j[7];
double pvt_val; /* Value of current pivot element */
double buf; /* Temporary storage */
for (k = 0; k < n; k++)
{
/* Locate k'th pivot element */
pvt_val = Y[k][k]; /* Initialize for search */
pvt_i[k] = k;
pvt_j[k] = k;
for(i = k; i < n; i++)
for(j = k; j < n; j++)
if(fabs(Y[i][j]) > fabs(pvt_val)) {
pvt_i[k] = i;
pvt_j[k] = j;
pvt_val = Y[i][j];
}
if(pvt_val==0) {
/* Matrix is singular (zero determinant). */
printf("Matrix is singular.");
getch();
exit(ERROR_CODE);
}
/* "Interchange" rows (with sign change stuff) */
i = pvt_i[k];
if (i != k) /* If rows are different */
for (j = 0; j < n; j++)
{
buf = -Y[k][j];
Y[k][j] = Y[i][j];
Y[i][j] = buf;
}
/* "Interchange" columns */
j = pvt_j[k];
if (j != k) /* If columns are different */
for (i = 0; i < n; i++)
{
buf = -Y[i][k];
Y[i][k] = Y[i][j];
Y[i][j] = buf;
}
/* Divide column by minus pivot value */
for (i = 0; i < n; i++)
if (i != k) /* Don't touch the pivot entry */
Y[i][k] /= ( -pvt_val) ; /* (Tricky C syntax for division) */
/* Reduce the matrix */
for (i = 0; i < n; i++)
{
buf = Y[i][k];
for (j = 0; j < n; j++)
if ( i != k && j != k ) /* Don't touch pivot. */
Y[i][j] += buf * Y[k][j];
}
/* Divide row by pivot */
for (j = 0; j < n; j++)
if (j != k) /* Don't touch the pivot! */
Y[k][j] /= pvt_val;
/* Replace pivot by reciprocal (at last we can touch it). */
Y[k][k] = 1.0/pvt_val;
}
/* That was most of the work, one final pass of row/column interchange */
/* to finish */
for (k = n-2; k >= 0; k--) /* Don't need to work with 1 by 1 corner */
{
i = pvt_j[k]; /* Rows to swap correspond to pivot COLUMN */
if (i != k) /* If rows are different */
for(j = 0; j < n; j++)
{
buf = Y[k][j];
Y[k][j] = -Y[i][j];
Y[i][j] = buf;
}
j = pvt_i[k]; /* Columns to swap correspond to pivot ROW */
if (j != k) /* If columns are different */
for (i = 0; i < n; i++)
{
buf = Y[i][k];
Y[i][k] = -Y[i][j];
Y[i][j] = buf;
}
}
return ;
According to this part, there are was developed program, that calculating input data for Eller method. Code of this program is represented in Appendix A.