1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-06-17 23:07:05 +01:00

DWT working and tested

This commit is contained in:
2022-02-18 14:06:52 +00:00
parent 65a656f257
commit 9e78b96260
4 changed files with 124 additions and 8 deletions

View File

@ -9,6 +9,7 @@ endif
noinst_PROGRAMS = \
exCompiledDoubleFunction\
exDerivative \
exDWT \
exFit \
exFitSample \
exIntegrator \
@ -30,6 +31,10 @@ exDerivative_SOURCES = exDerivative.cpp
exDerivative_CXXFLAGS = $(COM_CXXFLAGS)
exDerivative_LDFLAGS = -L../lib/.libs -lLatAnalyze
exDWT_SOURCES = exDWT.cpp
exDWT_CXXFLAGS = $(COM_CXXFLAGS)
exDWT_LDFLAGS = -L../lib/.libs -lLatAnalyze
exFit_SOURCES = exFit.cpp
exFit_CXXFLAGS = $(COM_CXXFLAGS)
exFit_LDFLAGS = -L../lib/.libs -lLatAnalyze

28
examples/exDWT.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <LatAnalyze/Numerical/DWT.hpp>
using namespace std;
using namespace Latan;
int main(void)
{
DVec data, dataRec;
vector<DWT::DWTLevel> dataDWT;
DWT dwt(DWTFilters::db3);
cout << "-- random data" << endl;
data.setRandom(16);
cout << data.transpose() << endl;
cout << "-- compute Daubechies 3 DWT" << endl;
dataDWT = dwt.forward(data, 4);
for (unsigned int l = 0; l < dataDWT.size(); ++l)
{
cout << "* level " << l << endl;
cout << "L= " << dataDWT[l].first.transpose() << endl;
cout << "H= " << dataDWT[l].second.transpose() << endl;
}
cout << "-- check inverse DWT" << endl;
dataRec = dwt.backward(dataDWT);
cout << "rel diff = " << 2.*(data - dataRec).norm()/(data + dataRec).norm() << endl;
return EXIT_SUCCESS;
}