Advertisement
Pagoniusz

Untitled

Apr 11th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. void check_diagonally_dominant(double **in_matrix, int size)
  2. {
  3.     double det_sum = 0, rest_sum=0;
  4.     for (int i = 0; i < size; i++)
  5.     {
  6.         for (int j = 0; j < size; j++)
  7.         {
  8.             if (i==j)
  9.             {
  10.                 det_sum += in_matrix[i][j];
  11.             }
  12.             else
  13.             {
  14.                 rest_sum += in_matrix[i][j];
  15.             }
  16.         }
  17.     }
  18.     if (abs(det_sum)>abs(rest_sum))
  19.     {
  20.         cout << "Macierz przekatniowo dominujaca.\n";
  21.     }
  22.     else
  23.     {
  24.         cout << "UWAGA! Macierz nie jest przekatniowo dominujaca. Mozliwe bledne wyniki.\n";
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement