disp_matrix.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /****************************************************************/
  2. /* disp_matrix() Function to display the contents of */
  3. /* the three matrices used in solving */
  4. /* the set of linear equations. */
  5. /* V.1.0, Jo Wood, 9th December, 1994. */
  6. /****************************************************************/
  7. #include "param.h"
  8. void disp_matrix(double **a, double *x, double *z, int n)
  9. /* Displays matrices used to solve a
  10. set of linear equations in the form
  11. _ _ _ _ _ _
  12. | a(0,0) a(0,1) ... a(0,n) | | x0 | | z0 |
  13. | a(1,0) a(1,1) ... a(1,n) | | x1 | | z1 |
  14. | : : ... : | . | : | = | : |
  15. | : : ... : | | : | | : |
  16. | a(n,0) a(n,1) ... a(n,n) | | xn | | zn |
  17. - - - - - -
  18. */
  19. {
  20. int row, col; /* Counts through the matrix */
  21. char dummy[128]; /* Kewboard input (pause) */
  22. for (row = 0; row < n; row++) {
  23. fprintf(stdout, "[ ");
  24. for (col = 0; col < n; col++)
  25. fprintf(stdout, "%.3f\t", a[row][col] / 1);
  26. fprintf(stdout, "]\t[ %.0f\t]\t[ %.0f\t]\n", x[row], z[row]);
  27. }
  28. fprintf(stdout, "\n\n");
  29. fgets(dummy, 70, stdin);
  30. }
  31. void disp_wind(CELL * z)
  32. { /* Local window */
  33. int row, col; /* Count through local window. */
  34. char dummy[128];
  35. for (row = 0; row < wsize; row++) {
  36. for (col = 0; col < wsize; col++)
  37. fprintf(stdout, "%d\t", *(z + (row * wsize) + col));
  38. fprintf(stdout, "\n");
  39. }
  40. fgets(dummy, 70, stdin);
  41. }