mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-10 19:20:44 +01:00
minor code cleaning and examples update
This commit is contained in:
parent
db61c7ea90
commit
84d063edf0
@ -15,15 +15,25 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
noinst_PROGRAMS = \
|
noinst_PROGRAMS = \
|
||||||
exMathInterpreter \
|
exCompiledDoubleFunction\
|
||||||
exCompiledDoubleFunction
|
exMat \
|
||||||
|
exMathInterpreter \
|
||||||
exMathInterpreter_SOURCES = exMathInterpreter.cpp
|
exPlot
|
||||||
exMathInterpreter_CFLAGS = -g -O2
|
|
||||||
exMathInterpreter_LDFLAGS = -L../latan/.libs -llatan
|
|
||||||
|
|
||||||
exCompiledDoubleFunction_SOURCES = exCompiledDoubleFunction.cpp
|
exCompiledDoubleFunction_SOURCES = exCompiledDoubleFunction.cpp
|
||||||
exCompiledDoubleFunction_CFLAGS = -g -O2
|
exCompiledDoubleFunction_CFLAGS = -g -O2
|
||||||
exCompiledDoubleFunction_LDFLAGS = -L../latan/.libs -llatan
|
exCompiledDoubleFunction_LDFLAGS = -L../latan/.libs -llatan
|
||||||
|
|
||||||
|
exMat_SOURCES = exMat.cpp
|
||||||
|
exMat_CFLAGS = -g -O2
|
||||||
|
exMat_LDFLAGS = -L../latan/.libs -llatan
|
||||||
|
|
||||||
|
exMathInterpreter_SOURCES = exMathInterpreter.cpp
|
||||||
|
exMathInterpreter_CFLAGS = -g -O2
|
||||||
|
exMathInterpreter_LDFLAGS = -L../latan/.libs -llatan
|
||||||
|
|
||||||
|
exPlot_SOURCES = exPlot.cpp
|
||||||
|
exPlot_CFLAGS = -g -O2
|
||||||
|
exPlot_LDFLAGS = -L../latan/.libs -llatan
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I .buildutils/m4
|
ACLOCAL_AMFLAGS = -I .buildutils/m4
|
||||||
|
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;
|
||||||
|
}
|
@ -41,35 +41,3 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*int main(void)
|
|
||||||
{
|
|
||||||
ASCIIFile F;
|
|
||||||
DMat A,B;
|
|
||||||
|
|
||||||
F.Open("foo.boot",FileMode::Read);
|
|
||||||
A = F.Read<DMat>("bla");
|
|
||||||
B = F.Read<DMat>("bli");
|
|
||||||
cout << A << endl;
|
|
||||||
cout << B << endl;
|
|
||||||
cout << A*B << endl;
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
DMat m(2,2);
|
|
||||||
|
|
||||||
m(0,6) = 3;
|
|
||||||
m(1,0) = 2.5;
|
|
||||||
m(0,1) = -1;
|
|
||||||
m(1,1) = m(1,0) + m(0,1);
|
|
||||||
cout << "Here is the matrix m:\n" << m << endl;
|
|
||||||
DVec v(2);
|
|
||||||
v(0) = 4;
|
|
||||||
v(1) = v(0) - 1;
|
|
||||||
cout << "Here is the vector v:\n" << v << endl;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
16
examples/exPlot.cpp
Normal file
16
examples/exPlot.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <latan/Plot.hpp>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace Latan;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
Plot p;
|
||||||
|
|
||||||
|
p << PlotCommand("x**2") << PlotCommand("x**3") << PlotCommand("x**4");
|
||||||
|
cout << p << endl;
|
||||||
|
p.display();
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
@ -34,7 +34,7 @@
|
|||||||
BEGIN_NAMESPACE
|
BEGIN_NAMESPACE
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Parser classes *
|
* Expression node class *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
class MathNode
|
class MathNode
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ DECL_OP(Div);
|
|||||||
DECL_OP(Pow);
|
DECL_OP(Pow);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Compiler class *
|
* Interpreter class *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
class MathInterpreter
|
class MathInterpreter
|
||||||
{
|
{
|
||||||
|
@ -40,10 +40,10 @@ private:
|
|||||||
virtual void initScanner(void) = 0;
|
virtual void initScanner(void) = 0;
|
||||||
virtual void destroyScanner(void) = 0;
|
virtual void destroyScanner(void) = 0;
|
||||||
public:
|
public:
|
||||||
DataObj* data;
|
DataObj *data;
|
||||||
void* scanner;
|
void *scanner;
|
||||||
std::istream* stream;
|
std::istream *stream;
|
||||||
std::string* streamName;
|
std::string *streamName;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user