2014-02-10 11:22:56 +00:00
|
|
|
#include <iostream>
|
2015-10-01 00:13:34 +01:00
|
|
|
#include <LatAnalyze/Io.hpp>
|
2014-03-13 18:51:01 +00:00
|
|
|
#include <LatAnalyze/Mat.hpp>
|
|
|
|
#include <LatAnalyze/Math.hpp>
|
2014-02-10 11:22:56 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Latan;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2014-03-12 19:54:27 +00:00
|
|
|
DMat A(2, 3), B(3, 2);
|
2015-10-01 00:13:34 +01:00
|
|
|
const string fileName = "exMat.h5";
|
2014-02-10 11:22:56 +00:00
|
|
|
|
2014-03-12 19:54:27 +00:00
|
|
|
A << 1, 2, 3,
|
|
|
|
4, 5, 6;
|
|
|
|
|
|
|
|
B << 1.0, 2.5,
|
|
|
|
4.5, 8.9,
|
|
|
|
1.2, 3.5;
|
|
|
|
|
2014-02-10 11:22:56 +00:00
|
|
|
// read
|
2014-03-12 19:54:27 +00:00
|
|
|
cout << "A=\n" << A << '\n' << endl;
|
|
|
|
cout << "B=\n" << B << '\n' << endl;
|
|
|
|
cout << "A*B=\n" << A*B << '\n' << endl;
|
|
|
|
cout << "cos(A)=\n" << A.unaryExpr(StdMath::cos) << '\n' << endl;
|
2014-02-10 11:22:56 +00:00
|
|
|
|
|
|
|
// write
|
2015-10-01 00:13:34 +01:00
|
|
|
cout << "-- saving and loading A*B using '" + fileName + "'..." << endl;
|
|
|
|
Io::save(A*B, fileName, File::Mode::write, "AB");
|
|
|
|
|
|
|
|
DMat C = Io::load<DMat>(fileName);
|
|
|
|
cout << C << endl;
|
|
|
|
|
2014-02-10 11:22:56 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|