mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-06-22 00:42:02 +01:00
minor code cleaning and examples update
This commit is contained in:
30
examples/exMat.cpp
Normal file
30
examples/exMat.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <latan/Io.hpp>
|
||||
#include <latan/Mat.hpp>
|
||||
|
||||
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");
|
||||
cout << "A=\n" << A << '\n' << endl;
|
||||
cout << "B=\n" << B << '\n' << endl;
|
||||
cout << "A*B=\n" << A*B << '\n' << endl;
|
||||
F.close();
|
||||
|
||||
// write
|
||||
cout << "-- saving A*B..." << endl;
|
||||
F.open(fileName, File::Mode::append);
|
||||
F.save((A*B).eval(), "AB");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user