diff options
author | justanothercatgirl <sotov2070@gmail.com> | 2024-11-18 23:40:21 +0300 |
---|---|---|
committer | justanothercatgirl <sotov2070@gmail.com> | 2024-11-18 23:40:21 +0300 |
commit | 89d26d5d0e8ff2b026cc99606868699f6fcc08db (patch) | |
tree | 22181a56c8a1cf2ecae3c167402898c7aed38fb8 /libprakpp/tests/test_include.cpp | |
parent | e1bf912316b7f156218aaf5d8571443e47d880ed (diff) |
added tempalte
Diffstat (limited to 'libprakpp/tests/test_include.cpp')
-rw-r--r-- | libprakpp/tests/test_include.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libprakpp/tests/test_include.cpp b/libprakpp/tests/test_include.cpp new file mode 100644 index 0000000..af61860 --- /dev/null +++ b/libprakpp/tests/test_include.cpp @@ -0,0 +1,31 @@ +#include "prakmath.hpp" +#include "prakmatrix.hpp" + +int main() { + using namespace prak; + matrix<double> A(2, 1, {-1, 1}); + matrix<double> B(1, 2, {1, -2}); + matrix<double> C = A*B * (1.0/1.0); + std::cout << A << '\n' << B << '\n' << C << std::endl; + matrix<double> D = C + matrix<double>(2, 2, {-1, -2, -3, -4}); + std::getchar(); + D.feq_precision = 10; + matrix<double> A_1 = D.inv().value(); + std::cout << A_1 << std::endl; + std::cout << A_1*D << D*A_1 << std::endl; + matrix<double> E(2, 3, {1, 2, 3, 4, 5, 6}); + std::cout << E << '\n' << E.tr() << std::endl; + std::vector<double> xs = {0, 1, 2, 3, 4, 5, 6, 7}; + std::vector<double> ys = {1, 2.9, 5.2, 7.1, 9, 11.05, 12.7, 14}; + /* std::vector<double> ss = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}; */ + std::vector<double> ss = {0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}; + /* std::vector<double> xs = {0, 1, 2}; */ + /* std::vector<double> ys = {1, 2.9, 5.2}; */ + /* std::vector<double> ss = {0.1, 0.2, 0.3}; */ + polynomial_regression(2, xs, ys, std::make_optional(ss)); + + matrix<double> T1 (3, 3, {1, 2, 3, 0, 1, 2, 0, 0, 1}); + matrix<double> T2 (3, 3, {4, 5, 6, 0, 4, 5, 0, 0, 6}); + std::cout << T1 << '\n' << T2 << '\n' << T1 * T1 << std::endl; + +} |