Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //делаем единицы на главной диагонали
- for (int i = 0; i < k; ++i)
- {
- if (Gsys[i][i] != 1)
- for (int m = i; m < n; ++m)
- {
- if (Gsys[i][m] == 1)
- {
- swapColumnsGsys(i, m);
- break;
- }
- }
- }
- //Теперь матрица диагональная. Пройдемся вниз.
- for (int i = 0; i < k; ++i) // columns
- {
- for (int j = i+1; j < k; ++j) // rows
- {
- if (Gsys[j][i] != 0)
- Gsys[j] = addRows(Gsys[j], Gsys[i]);
- printGsys();
- }
- }
- //И вверх
- for (int i = k-1; i >= 0; --i) // columns
- {
- for (int j = i -1; j >= 0; --j) // rows
- {
- if (Gsys[j][i] != 0)
- Gsys[j] = addRows(Gsys[j], Gsys[i]);
- printGsys();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement