1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

Merge branch 'develop' into release/3.2

This commit is contained in:
Antonin Portelli 2016-06-14 18:55:25 +01:00
commit 84993d85b4
2 changed files with 44 additions and 0 deletions

View File

@ -8,6 +8,7 @@ endif
bin_PROGRAMS = \
latan-sample-combine \
latan-sample-element \
latan-sample-fake \
latan-sample-plot-corr\
latan-sample-read \
@ -17,6 +18,10 @@ latan_sample_combine_SOURCES = sample-combine.cpp
latan_sample_combine_CXXFLAGS = $(COM_CXXFLAGS)
latan_sample_combine_LDFLAGS = -L../lib/.libs -lLatAnalyze
latan_sample_element_SOURCES = sample-element.cpp
latan_sample_element_CXXFLAGS = $(COM_CXXFLAGS)
latan_sample_element_LDFLAGS = -L../lib/.libs -lLatAnalyze
latan_sample_fake_SOURCES = sample-fake.cpp
latan_sample_fake_CXXFLAGS = $(COM_CXXFLAGS)
latan_sample_fake_LDFLAGS = -L../lib/.libs -lLatAnalyze

39
utils/sample-element.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <iostream>
#include <string>
#include <LatAnalyze/Io.hpp>
#include <LatAnalyze/MatSample.hpp>
int main(int argc, char* argv[])
{
using namespace std;
using namespace Latan;
if (argc != 4 and argc != 5) {
cout << "Usage: " << argv[0] << " <input filename> <row> <column> ";
cout << "[output filename]" << endl;
return -1;
}
string inFileName = argv[1];
auto row = strTo<Index>(argv[2]);
auto col = strTo<Index>(argv[3]);
string outFileName = (argc == 5) ? argv[4] : "";
auto inputData = Io::load<DMatSample>(inFileName);
cout << scientific;
cout << "central value:\n" << inputData[central](row, col) << endl;
cout << "standard deviation:\n";
cout << inputData.variance().cwiseSqrt()(row, col) << endl;
if (not outFileName.empty())
{
DSample outputData(inputData.size());
FOR_STAT_ARRAY(inputData, s) {
outputData[s] = inputData[s](row, col);
}
Io::save(outputData, outFileName);
}
}