home *** CD-ROM | disk | FTP | other *** search
- yenbob(a,icola,icol)
-
- /*purpose...finds the solution of a system of N equations */
- /*in N unknowns. */
-
- int icol,icola;
- float a[];
-
- {
- int i,icol1,index1,index2,index3,index4,j,k;
-
-
- icol1 = icol + 1;
- for(k = 0; k <= icol-1; k++)
- {
- index1 = k + (k * icola);
- a[index1] = 1./a[index1];
-
- for(j = 0; j <= icol1-1; j++)
- {
- if((j-k) != 0)
- {
- index2 = j + (k * icola);
- a[index2] = a[index2] * a[index1];
- }
- }
-
- for(i = 0; i <= icol-1; i++)
- {
- if((i - k) != 0)
- {
- index3 = k + (i * icola);
- for(j = 0; j <= icol1-1; j++)
- {
- if((j - k) != 0)
- {
- index2 = j + (i * icola);
- index4 = j + (k * icola);
- a[index2] = a[index2] - (a[index4] * a[index3]);
- }
- }
- }
- }
- for(i = 0; i <= icol-1; i++)
- {
- if((i - k) != 0)
- {
- index2 = k + (i * icola);
- a[index2] = -a[index2] * a[index1];
- }
- }
- }
- }
-