cpp/matrix/main.cpp
2023-07-16 10:03:47 +03:00

50 lines
1 KiB
C++

#include <bits/stdc++.h>
#include "matrix.h"
using namespace std;
int main() {
BigInteger d = 1000000;
d *= d;
d /= 132;
cout << d << endl;
Matrix<20, 20, Rational> a;
for (size_t i = 0; i < a.getRow(0).size(); ++i) {
for (size_t j = 0; j < a.getColumn(0).size(); ++j) {
cin >> a[i][j];
}
}
for (size_t i = 0; i < a.getRow(0).size(); ++i) {
for (size_t j = 0; j < a.getColumn(0).size(); ++j) {
cout << setprecision(20) << (double)a[i][j] << " ";
}
cout << endl;
}
cout << "START INVERTED" << endl;
auto s = a.inverted();
cout << "END INVERTED" << endl;
Matrix<20, 20, double> result;
for (size_t i = 0; i < a.getRow(0).size(); ++i) {
for (size_t j = 0; j < a.getColumn(0).size(); ++j) {
cin >> result[i][j];
}
}
for (size_t i = 0; i < s.getRow(0).size(); ++i) {
for (size_t j = 0; j < s.getColumn(0).size(); ++j) {
if (abs((double)s[i][j] - result[i][j]) < 1e-6) continue;
cout << setprecision(8) << (double)s[i][j] << " ";
}
cout << endl;
}
return 0;
}