mirror of
				https://github.com/aportelli/LatAnalyze.git
				synced 2025-10-21 20:24:44 +01:00 
			
		
		
		
	improvement of matrix example
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <latan/Io.hpp> | #include <latan/Io.hpp> | ||||||
| #include <latan/Mat.hpp> | #include <latan/Mat.hpp> | ||||||
|  | #include <latan/Math.hpp> | ||||||
|  |  | ||||||
| using namespace std; | using namespace std; | ||||||
| using namespace Latan; | using namespace Latan; | ||||||
| @@ -16,15 +17,16 @@ int main(void) | |||||||
|     F.open(fileName, File::Mode::read); |     F.open(fileName, File::Mode::read); | ||||||
|     A = F.read<DMat>("A"); |     A = F.read<DMat>("A"); | ||||||
|     B = F.read<DMat>("B"); |     B = F.read<DMat>("B"); | ||||||
|     cout << "A=\n"   << A   << '\n' << endl; |     cout << "A=\n"      << A                         << '\n' << endl; | ||||||
|     cout << "B=\n"   << B   << '\n' << endl; |     cout << "B=\n"      << B                         << '\n' << endl; | ||||||
|     cout << "A*B=\n" << A*B << '\n' << endl; |     cout << "A*B=\n"    << A*B                       << '\n' << endl; | ||||||
|  |     cout << "cos(A)=\n" << A.unaryExpr(StdMath::cos) << '\n' << endl; | ||||||
|     F.close(); |     F.close(); | ||||||
|      |      | ||||||
|     // write |     // write | ||||||
|     cout << "-- saving A*B..." << endl; |     cout << "-- saving A*B..." << endl; | ||||||
|     F.open(fileName, File::Mode::append); |     F.open(fileName, File::Mode::append); | ||||||
|     F.save((A*B).eval(), "AB"); |     F.save(A*B, "AB"); | ||||||
|      |      | ||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user