2014-02-10 11:22:56 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <latan/Io.hpp>
|
|
|
|
#include <latan/Mat.hpp>
|
2014-02-12 18:35:18 +00:00
|
|
|
#include <latan/Math.hpp>
|
2014-02-10 11:22:56 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Latan;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
AsciiFile F;
|
|
|
|
DMat A,B;
|
|
|
|
const string fileName = "exMat.dat";
|
|
|
|
|
|
|
|
// read
|
|
|
|
cout << "-- reading " << fileName << "..." << endl;
|
|
|
|
F.open(fileName, File::Mode::read);
|
|
|
|
A = F.read<DMat>("A");
|
|
|
|
B = F.read<DMat>("B");
|
2014-02-13 19:23:39 +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
|
|
|
F.close();
|
|
|
|
|
|
|
|
// write
|
|
|
|
cout << "-- saving A*B..." << endl;
|
|
|
|
F.open(fileName, File::Mode::append);
|
2014-02-12 18:35:18 +00:00
|
|
|
F.save(A*B, "AB");
|
2014-02-10 11:22:56 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|