NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_sort.h>
#include <algorithm>
#include <memory>
#include "command_implementations.hpp"
#include "parser_functions.hpp"
#include "matrixoperations.hpp"
#include "spline.h"
#include "wavelet.hpp"
#include "filtering.hpp"
#include "../AudioLib/audiofile.hpp"
#include "../../kernel.hpp"
#include "../../../common/http.h"
Go to the source code of this file.
Classes | |
struct | FFTData |
This structure gathers all information needed for calculating a FFT in one or two dimensions. More... | |
Macros | |
#define | TRAPEZOIDAL 1 |
#define | SIMPSON 2 |
Functions | |
static mu::value_type | localizeExtremum (string &sCmd, mu::value_type *dVarAdress, Parser &_parser, const Settings &_option, mu::value_type dLeft, mu::value_type dRight, double dEps, int nRecursion) |
This function searches for the positions of all extrema, which are located in the selected interval. More... | |
static mu::value_type | localizeZero (string &sCmd, mu::value_type *dVarAdress, Parser &_parser, const Settings &_option, mu::value_type dLeft, mu::value_type dRight, double dEps, int nRecursion) |
This function searches for the positions of all zeroes (roots), which are located in the selected interval. More... | |
static std::vector< size_t > | getSamplesForDatagrid (CommandLineParser &cmdParser, const std::vector< size_t > &nSamples) |
This function will obtain the samples of the datagrid for each spatial direction. More... | |
static void | expandVectorToDatagrid (IntervalSet &ivl, vector< vector< mu::value_type > > &vZVals, size_t nSamples_x, size_t nSamples_y) |
This function will expand the z vector into a z matrix using triangulation. More... | |
static void | integrationstep_trapezoidal (mu::value_type &x, mu::value_type x0, mu::value_type dx, vector< mu::value_type > &vResult, vector< mu::value_type > &vFunctionValues, bool bReturnFunctionPoints) |
This static function performs an integration step using a trapezoidal approximation algorithm. More... | |
static void | integrationstep_simpson (mu::value_type &x, mu::value_type x0, mu::value_type x1, double dx, vector< mu::value_type > &vResult, vector< mu::value_type > &vFunctionValues, bool bReturnFunctionPoints) |
This static function performs an integration step using the Simpson approximation algorithm. More... | |
static vector< mu::value_type > | integrateSingleDimensionData (CommandLineParser &cmdParser) |
This static function integrates single dimension data. More... | |
bool | integrate (CommandLineParser &cmdParser) |
Calculate the integral of a function or a data set in a single dimension. More... | |
static void | refreshBoundaries (IntervalSet &ivl, const string &sIntegrationExpression) |
This static function re-evaluates the boundary expression and updates the internal variables correspondingly. More... | |
bool | integrate2d (CommandLineParser &cmdParser) |
Calculate the integral of a function in two dimensions. More... | |
bool | differentiate (CommandLineParser &cmdParser) |
Calculate the numerical differential of the passed expression or data set. More... | |
static string | getIntervalForSearchFunctions (const string &sParams, string &sVar) |
This static function extracts the interval definition for the extrema and root search functions. More... | |
static bool | findExtremaInMultiResult (CommandLineParser &cmdParser, string &sExpr, string &sInterval, int nOrder, int nMode) |
This static function finds extrema in a multi-result expression, i.e. an expression containing a table or similar. More... | |
static double | calculateMedian (value_type *v, int nResults, int start, int nOrder, int nanShiftStart, int &nNewNanShift) |
Static helper function for findExtremaInData. More... | |
static bool | findExtremaInData (CommandLineParser &cmdParser, string &sExpr, int nOrder, int nMode) |
This static function finds extrema in the selected data sets. More... | |
bool | findExtrema (CommandLineParser &cmdParser) |
This function is a wrapper to the actual extrema localisation function localizeExtremum() further below. More... | |
static bool | findZeroesInMultiResult (CommandLineParser &cmdParser, string &sExpr, string &sInterval, int nMode) |
This static function finds zeroes in a multi-result expression, i.e. an expression containing a table or similar. More... | |
static bool | findZeroesInData (CommandLineParser &cmdParser, string &sExpr, int nMode) |
This static function finds zeroes in the selected data set. More... | |
bool | findZeroes (CommandLineParser &cmdParser) |
This function is a wrapper to the actual zeros localisation function localizeZero() further below. More... | |
void | taylor (CommandLineParser &cmdParser) |
This function approximates the passed expression using Taylor's method. More... | |
static bool | detectPhaseOverflow (std::complex< double > cmplx[3]) |
This static function is a helper function for fastFourierTransform() and detects phase overflows, which can be reconstructed during calculations. More... | |
static std::vector< size_t > | getShiftedAxis (size_t nElements, bool inverseTrafo) |
Calculates an axis index, which performs the necessary data flips used for the shifted fft axis. More... | |
static void | calculate1dFFT (MemoryManager &_data, Indices &_idx, const std::string &sTargetTable, mglDataC &_fftData, std::vector< size_t > &vAxis, FFTData &_fft) |
This static function calculates a 1D FFT and stores the result in the target table. More... | |
static void | calculate2dFFT (MemoryManager &_data, Indices &_idx, const std::string &sTargetTable, mglDataC &_fftData, std::vector< size_t > &vAxis, FFTData &_fft) |
This static function calculates a 2D FFT and stores the result in the target table. More... | |
bool | fastFourierTransform (CommandLineParser &cmdParser) |
This function calculates the fast fourier transform of the passed data set. More... | |
bool | fastWaveletTransform (CommandLineParser &cmdParser) |
This function calculates the fast wavelet transform of the passed data set. More... | |
bool | evalPoints (CommandLineParser &cmdParser) |
This function samples a defined expression in an array of discrete values. More... | |
bool | createDatagrid (CommandLineParser &cmdParser) |
This function calculates a datagrid from passed functions or (x-y-z) data values. More... | |
bool | writeAudioFile (CommandLineParser &cmdParser) |
This function creates a WAVE file from the selected data set. More... | |
bool | readAudioFile (CommandLineParser &cmdParser) |
Reads either the audio file meta information or the whole audio file to memory. More... | |
bool | seekInAudioFile (CommandLineParser &cmdParser) |
Seek a position in an audiofile and extract a length of samples from it. More... | |
bool | regularizeDataSet (CommandLineParser &cmdParser) |
This function regularizes the samples of a defined x-y-data array such that DeltaX is equal for every x. More... | |
bool | analyzePulse (CommandLineParser &cmdParser) |
This function performs a pulse analysis on the selected data set. More... | |
bool | shortTimeFourierAnalysis (CommandLineParser &cmdParser) |
This function performs the short-time fourier analysis on the passed data set. More... | |
static double | interpolateToGrid (const std::vector< double > &vAxis, double dInterpolVal, bool bExtent=false) |
This static function is a helper for boneDetection to map/interpolate the calculated values to the final grid. More... | |
void | boneDetection (CommandLineParser &cmdParser) |
This function is the implementation of the detect command. More... | |
bool | calculateSplines (CommandLineParser &cmdParser) |
This function approximates the passed data set using cubic splines. More... | |
void | rotateTable (CommandLineParser &cmdParser) |
This function rotates a table, an image or a datagrid around a specified angle. More... | |
value_type | parser_Random (const value_type &vRandMin, const value_type &vRandMax) |
This function returns a uniformly distributed random number between both boundaries. More... | |
void | particleSwarmOptimizer (CommandLineParser &cmdParser) |
This function implements a particle swarm optimizer in up to four dimensions (depending on the number of intervals defined). The optimizer has an adaptive velocity part, reducing the overall position variation of the particles over time. More... | |
std::string | removeQuotationMarks (const std::string &) |
This function simply removes the surrounding quotation marks. More... | |
void | urlExecute (CommandLineParser &cmdParser) |
This function implements the url command providing an interface to http(s) and (s)ftp URLs. More... | |
Variables | |
DefaultVariables | _defVars |
#define SIMPSON 2 |
Definition at line 35 of file command_implementations.cpp.
#define TRAPEZOIDAL 1 |
Definition at line 34 of file command_implementations.cpp.
bool analyzePulse | ( | CommandLineParser & | cmdParser | ) |
This function performs a pulse analysis on the selected data set.
cmdParser | CommandLineParser& |
The function calculates the maximal amplitude, its position, the FWHM, the width near the maximal amplitude (which is different from the FWHM) and the energy in the pulse.
Definition at line 3915 of file command_implementations.cpp.
References _lang, extractRange(), Language::get(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), make_hline(), VectorIndex::OPEN_END, NumeReKernel::print(), NumeReKernel::printPreFmt(), CommandLineParser::setReturnValue(), SyntaxError::TABLE_DOESNT_EXIST, NumeReKernel::toggleTableStatus(), toString(), and toUpperCase().
Referenced by cmd_pulse().
void boneDetection | ( | CommandLineParser & | cmdParser | ) |
This function is the implementation of the detect command.
cmdParser | CommandLineParser& |
Definition at line 4133 of file command_implementations.cpp.
References _lang, Indices::col, extractRange(), VectorIndex::front(), Language::get(), MemoryManager::getAppendedZeroes(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), CommandLineParser::getTargetTable(), interpolateToGrid(), mu::isnan(), VectorIndex::isOpenEnd(), min, VectorIndex::OPEN_END, NumeReKernel::print(), mu::real(), Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::setOpenEndIndex(), VectorIndex::setRange(), VectorIndex::size(), VectorIndex::subidx(), SyntaxError::TABLE_DOESNT_EXIST, and MemoryManager::writeToTable().
Referenced by cmd_detect().
|
static |
This static function calculates a 1D FFT and stores the result in the target table.
_data | MemoryManager& |
_idx | Indices& |
sTargetTable | const std::string& |
_fftData | mglDataC& |
vAxis | std::vector<size_t>& |
_fft | FFTData& |
Definition at line 2588 of file command_implementations.cpp.
References _lang, date::abs(), FFTData::bComplex, FFTData::bInverseTrafo, FFTData::bShiftAxis, Indices::col, detectPhaseOverflow(), FFTData::dFrequencyOffset, FFTData::dNyquistFrequency, FFTData::dTimeInterval, VectorIndex::front(), Language::get(), getShiftedAxis(), VectorIndex::isOpenEnd(), FFTData::lines, M_PI, Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::setRange(), VectorIndex::size(), and MemoryManager::writeToTable().
Referenced by fastFourierTransform().
|
static |
This static function calculates a 2D FFT and stores the result in the target table.
_data | MemoryManager& |
_idx | Indices& |
sTargetTable | const std::string& |
_fftData | mglDataC& |
vAxis | std::vector<size_t>& |
_fft | FFTData& |
Definition at line 2713 of file command_implementations.cpp.
References _lang, date::abs(), FFTData::bComplex, FFTData::bInverseTrafo, FFTData::bShiftAxis, Indices::col, FFTData::cols, FFTData::dNyquistFrequency, FFTData::dTimeInterval, VectorIndex::front(), Language::get(), VectorIndex::isOpenEnd(), FFTData::lines, max, Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::setRange(), VectorIndex::size(), toString(), and MemoryManager::writeToTable().
Referenced by fastFourierTransform().
|
static |
Static helper function for findExtremaInData.
v | value_type* |
nResults | int |
start | int |
nOrder | int |
nanShiftStart | int |
nNewNanShift | int& |
Definition at line 1272 of file command_implementations.cpp.
References mu::isnan(), and mu::real().
Referenced by findExtremaInData().
bool calculateSplines | ( | CommandLineParser & | cmdParser | ) |
This function approximates the passed data set using cubic splines.
cmdParser | CommandLineParser& |
The calculated spline polynomials are defined as new custom functions.
Definition at line 4253 of file command_implementations.cpp.
References _lang, NumeReKernel::bSupressAnswer, FunctionDefinitionManager::defineFunc(), extractRange(), Language::get(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), NumeReKernel::getDefinitions(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeReKernel::getSettings(), FunctionDefinitionManager::isDefined(), NumeReKernel::issueWarning(), NumeReKernel::print(), Settings::systemPrints(), SyntaxError::TABLE_DOESNT_EXIST, SyntaxError::TOO_FEW_DATAPOINTS, and toString().
Referenced by cmd_spline().
bool createDatagrid | ( | CommandLineParser & | cmdParser | ) |
This function calculates a datagrid from passed functions or (x-y-z) data values.
cmdParser | CommandLineParser& |
Definition at line 3312 of file command_implementations.cpp.
References _defVars, date::abs(), CommandLineParser::clearReturnValue(), Indices::col, mu::ParserBase::Eval(), expandVectorToDatagrid(), CommandLineParser::exprContainsDataObjects(), VectorIndex::front(), MemoryManager::getColElements(), MemoryManager::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getExprAsMathExpression(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getSamplesForDatagrid(), CommandLineParser::getTargetTable(), CommandLineParser::hasParam(), intCast(), IntervalSet::intervals, VectorIndex::INVALID, SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, DataAccessParser::isCluster(), VectorIndex::isOpenEnd(), isValidIndexSet(), CommandLineParser::parseIntervals(), Indices::row, mu::ParserBase::SetExpr(), MemoryManager::setHeadLineElement(), VectorIndex::setRange(), CommandLineParser::setReturnValue(), IntervalSet::size(), VectorIndex::size(), VectorIndex::subidx(), SyntaxError::TABLE_DOESNT_EXIST, VectorIndex::to_string(), SyntaxError::TOO_FEW_DATAPOINTS, toString(), DefaultVariables::vValue, and MemoryManager::writeToTable().
Referenced by cmd_datagrid().
|
static |
This static function is a helper function for fastFourierTransform() and detects phase overflows, which can be reconstructed during calculations.
cmplx | std::complex<double>[3] |
Definition at line 2499 of file command_implementations.cpp.
References M_PI.
Referenced by calculate1dFFT().
bool differentiate | ( | CommandLineParser & | cmdParser | ) |
Calculate the numerical differential of the passed expression or data set.
cmdParser | CommandLineParser |
Definition at line 754 of file command_implementations.cpp.
References _lang, date::abs(), NumeRe::SavitzkyGolayDiffFilter::apply(), FunctionDefinitionManager::call(), Indices::col, MemoryManager::containsTablesOrClusters(), mu::Parser::Diff(), mu::ParserBase::Eval(), VectorIndex::front(), SyntaxError::FUNCTION_ERROR, Language::get(), CommandLineParser::getCommandLine(), getDataElements(), DataAccessParser::getDataObject(), NumeReKernel::getDefinitions(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getExprAsMathExpression(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), MemoryManager::getLines(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), getNextArgument(), CommandLineParser::getParameterList(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getPointerToVariable(), NumeReKernel::getSettings(), CommandLineParser::hasParam(), intCast(), intPower(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), VectorIndex::isOpenEnd(), NumeReKernel::issueWarning(), MemoryManager::isValidElement(), isValidIndexSet(), min, SyntaxError::NO_DIFF_OPTIONS, SyntaxError::NO_DIFF_VAR, Indices::row, mu::ParserBase::SetExpr(), VectorIndex::setRange(), CommandLineParser::setReturnValue(), VectorIndex::size(), MemoryManager::sortElements(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), VectorIndex::to_string(), and MemoryManager::writeToTable().
Referenced by cmd_diff().
bool evalPoints | ( | CommandLineParser & | cmdParser | ) |
This function samples a defined expression in an array of discrete values.
cmdParser | CommandLineParser& |
Definition at line 3175 of file command_implementations.cpp.
References MemoryManager::containsTablesOrClusters(), convertVectorToExpression(), mu::ParserBase::Eval(), SyntaxError::EVAL_VAR_NOT_FOUND, getAllIndices(), CommandLineParser::getAllParametersWithValues(), CommandLineParser::getCommandLine(), getDataElements(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getPointerToVariable(), CommandLineParser::hasParam(), intCast(), IntervalSet::intervals, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), min, CommandLineParser::parseIntervals(), mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), IntervalSet::size(), and SyntaxError::WRONG_PLOT_INTERVAL_FOR_LOGSCALE.
Referenced by cmd_eval().
|
static |
This function will expand the z vector into a z matrix using triangulation.
ivl | IntervalSet& |
vZVals | vector<vector<mu::value_type>>& |
nSamples_x | size_t |
nSamples_y | size_t |
Definition at line 3549 of file command_implementations.cpp.
References mu::real().
Referenced by createDatagrid().
bool fastFourierTransform | ( | CommandLineParser & | cmdParser | ) |
This function calculates the fast fourier transform of the passed data set.
cmdParser | CommandLineParser& |
The user may switch between complex or phase- amplitude layout and whether an inverse transform shall be calculated.
Definition at line 2855 of file command_implementations.cpp.
References _lang, FFTData::bComplex, FFTData::bInverseTrafo, FFTData::bShiftAxis, calculate1dFFT(), calculate2dFFT(), FFTData::cols, FFTData::dFrequencyOffset, FFTData::dNyquistFrequency, FFTData::dTimeInterval, extractRange(), Language::get(), CommandLineParser::getCommand(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExpr(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), NumeReKernel::getSettings(), getShiftedAxis(), CommandLineParser::getTargetTable(), CommandLineParser::hasParam(), mu::isnan(), LineBreak(), FFTData::lines, VectorIndex::OPEN_END, NumeReKernel::printPreFmt(), mu::real(), Settings::systemPrints(), SyntaxError::TABLE_DOESNT_EXIST, toString(), toSystemCodePage(), and SyntaxError::WRONG_DATA_SIZE.
Referenced by cmd_fft().
bool fastWaveletTransform | ( | CommandLineParser & | cmdParser | ) |
This function calculates the fast wavelet transform of the passed data set.
cmdParser | CommandLineParser& |
The user may select the wavelet type from a predefined set of wavelets and determine, whether an inverse transform shall be calculated.
Definition at line 3003 of file command_implementations.cpp.
References _lang, BSpline, calculateWavelet(), CenteredBSpline, CenteredDaubechies, CenteredHaar, Indices::col, Daubechies, decodeWaveletData(), extractRange(), VectorIndex::front(), Language::get(), NumeRe::Table::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeRe::Table::getLines(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getSettings(), CommandLineParser::getTargetTable(), NumeRe::Table::getValue(), Haar, CommandLineParser::hasParam(), intCast(), VectorIndex::INVALID, VectorIndex::isOpenEnd(), LineBreak(), NumeReKernel::printPreFmt(), Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::setRange(), Settings::systemPrints(), SyntaxError::TABLE_DOESNT_EXIST, toSystemCodePage(), and MemoryManager::writeToTable().
Referenced by cmd_fwt().
bool findExtrema | ( | CommandLineParser & | cmdParser | ) |
This function is a wrapper to the actual extrema localisation function localizeExtremum() further below.
cmdParser | CommandLineParser& |
Definition at line 1398 of file command_implementations.cpp.
References date::abs(), FunctionDefinitionManager::call(), MemoryManager::containsTablesOrClusters(), mu::Parser::Diff(), mu::ParserBase::Eval(), CommandLineParser::exprContainsDataObjects(), SyntaxError::EXTREMA_VAR_NOT_FOUND, findCommand(), findExtremaInData(), findExtremaInMultiResult(), findParameter(), findVariableInExpression(), getAllIndices(), getArgAtPos(), CommandLineParser::getCommandLine(), getDataElements(), NumeReKernel::getDefinitions(), CommandLineParser::getExpr(), NumeReKernel::getInstance(), getIntervalForSearchFunctions(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), NumeReKernel::getParser(), getPointerToVariable(), Settings::getPrecision(), NumeReKernel::getSettings(), NumeReKernel::getStringParser(), intCast(), SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), NumeRe::StringParser::isStringExpression(), localizeExtremum(), SyntaxError::NO_EXTREMA_OPTIONS, SyntaxError::NO_EXTREMA_VAR, mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), and toString().
Referenced by cmd_extrema().
|
static |
This static function finds extrema in the selected data sets.
cmdParser | CommandLineParser& |
sExpr | string& |
nOrder | int |
nMode | int |
Definition at line 1303 of file command_implementations.cpp.
References calculateMedian(), mu::ParserBase::Eval(), CommandLineParser::getCommandLine(), NumeReKernel::getInstance(), NumeReKernel::getParser(), SyntaxError::invalid_position, SyntaxError::NO_EXTREMA_VAR, mu::real(), mu::ParserBase::SetExpr(), and CommandLineParser::setReturnValue().
Referenced by findExtrema().
|
static |
This static function finds extrema in a multi-result expression, i.e. an expression containing a table or similar.
cmdParser | CommandLineParser& |
sExpr | string& |
sInterval | string& |
nOrder | int |
nMode | int |
Definition at line 1123 of file command_implementations.cpp.
References date::abs(), mu::ParserBase::Eval(), MemoryManager::getElement(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getParser(), mu::isnan(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), MemoryManager::sortElements(), and MemoryManager::writeToTable().
Referenced by findExtrema().
bool findZeroes | ( | CommandLineParser & | cmdParser | ) |
This function is a wrapper to the actual zeros localisation function localizeZero() further below.
cmdParser | CommandLineParser& |
Definition at line 1859 of file command_implementations.cpp.
References date::abs(), FunctionDefinitionManager::call(), MemoryManager::containsTablesOrClusters(), mu::ParserBase::Eval(), CommandLineParser::exprContainsDataObjects(), findParameter(), findVariableInExpression(), findZeroesInData(), findZeroesInMultiResult(), getAllIndices(), getArgAtPos(), CommandLineParser::getCommandLine(), getDataElements(), NumeReKernel::getDefinitions(), CommandLineParser::getExpr(), NumeReKernel::getInstance(), getIntervalForSearchFunctions(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), NumeReKernel::getParser(), getPointerToVariable(), NumeReKernel::getSettings(), NumeReKernel::getStringParser(), intCast(), SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), NumeRe::StringParser::isStringExpression(), localizeExtremum(), localizeZero(), SyntaxError::NO_ZEROES_OPTIONS, SyntaxError::NO_ZEROES_VAR, mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), and SyntaxError::ZEROES_VAR_NOT_FOUND.
Referenced by cmd_zeroes().
|
static |
This static function finds zeroes in the selected data set.
cmdParser | CommandLineParser& |
sExpr | string& |
nMode | int |
Definition at line 1770 of file command_implementations.cpp.
References date::abs(), mu::ParserBase::Eval(), CommandLineParser::getCommandLine(), NumeReKernel::getInstance(), NumeReKernel::getParser(), SyntaxError::invalid_position, mu::isnan(), SyntaxError::NO_ZEROES_VAR, mu::real(), mu::ParserBase::SetExpr(), and CommandLineParser::setReturnValue().
Referenced by findZeroes().
|
static |
This static function finds zeroes in a multi-result expression, i.e. an expression containing a table or similar.
cmdParser | CommandLineParser& |
sExpr | string& |
sInterval | string& |
nMode | int |
Definition at line 1666 of file command_implementations.cpp.
References mu::ParserBase::Eval(), MemoryManager::getElement(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getParser(), mu::isnan(), Linearize(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), MemoryManager::sortElements(), and MemoryManager::writeToTable().
Referenced by findZeroes().
|
static |
This static function extracts the interval definition for the extrema and root search functions.
sParams | const string& |
sVar | string& |
Definition at line 1075 of file command_implementations.cpp.
References getArgAtPos(), getMatchingParenthesis(), and StripSpaces().
Referenced by findExtrema(), and findZeroes().
|
static |
This function will obtain the samples of the datagrid for each spatial direction.
cmdParser | CommandLineParser& |
nSamples | const std::vector<size_t>& |
Definition at line 3492 of file command_implementations.cpp.
References Indices::col, CommandLineParser::exprContainsDataObjects(), MemoryManager::getColElements(), MemoryManager::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, DataAccessParser::isCluster(), VectorIndex::isOpenEnd(), isValidIndexSet(), Indices::row, VectorIndex::setRange(), VectorIndex::size(), SyntaxError::TABLE_DOESNT_EXIST, VectorIndex::to_string(), and SyntaxError::TOO_FEW_DATAPOINTS.
Referenced by createDatagrid().
|
static |
Calculates an axis index, which performs the necessary data flips used for the shifted fft axis.
nElements | size_t |
inverseTrafo | bool |
Definition at line 2515 of file command_implementations.cpp.
Referenced by calculate1dFFT(), and fastFourierTransform().
bool integrate | ( | CommandLineParser & | cmdParser | ) |
Calculate the integral of a function or a data set in a single dimension.
cmdParser | CommandLineParser& |
Definition at line 272 of file command_implementations.cpp.
References _defVars, _lang, date::abs(), mu::ParserBase::Eval(), Language::get(), NumeReKernel::GetAsyncCancelState(), CommandLineParser::getCommandLine(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), NumeReKernel::getSettings(), CommandLineParser::hasParam(), intCast(), integrateSingleDimensionData(), integrationstep_simpson(), integrationstep_trapezoidal(), SyntaxError::INVALID_INTEGRATION_PRECISION, SyntaxError::INVALID_INTEGRATION_RANGES, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), MemoryManager::isTable(), max, min, SyntaxError::NO_INTEGRATION_FUNCTION, SyntaxError::NO_INTEGRATION_RANGES, CommandLineParser::parseIntervals(), NumeReKernel::printPreFmt(), SyntaxError::PROCESS_ABORTED_BY_USER, mu::rint(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SIMPSON, IntervalSet::size(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, Settings::systemPrints(), toString(), TRAPEZOIDAL, and DefaultVariables::vValue.
Referenced by cmd_integrate().
bool integrate2d | ( | CommandLineParser & | cmdParser | ) |
Calculate the integral of a function in two dimensions.
cmdParser | CommandLineParser& |
Definition at line 481 of file command_implementations.cpp.
References _defVars, _lang, date::abs(), mu::ParserBase::Eval(), Language::get(), NumeReKernel::GetAsyncCancelState(), CommandLineParser::getCommandLine(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), NumeReKernel::getSettings(), intCast(), integrationstep_simpson(), integrationstep_trapezoidal(), IntervalSet::intervals, SyntaxError::INVALID_INTEGRATION_PRECISION, SyntaxError::INVALID_INTEGRATION_RANGES, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), max, min, SyntaxError::NO_INTEGRATION_FUNCTION, SyntaxError::NO_INTEGRATION_RANGES, CommandLineParser::parseIntervals(), NumeReKernel::printPreFmt(), SyntaxError::PROCESS_ABORTED_BY_USER, refreshBoundaries(), mu::rint(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SIMPSON, DefaultVariables::sName, SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, Settings::systemPrints(), toString(), TRAPEZOIDAL, and DefaultVariables::vValue.
Referenced by cmd_integrate().
|
static |
This static function integrates single dimension data.
cmdParser& | ComandLineParser |
Definition at line 162 of file command_implementations.cpp.
References Indices::col, DataAccessParser::evalIndices(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), CommandLineParser::hasParam(), IntervalSet::intervals, MemoryManager::isValidElement(), CommandLineParser::parseIntervals(), Indices::row, VectorIndex::size(), MemoryManager::sortElements(), MemoryManager::sum(), and MemoryManager::writeToTable().
Referenced by integrate().
|
static |
This static function performs an integration step using the Simpson approximation algorithm.
x | mu::value_type& |
x0 | mu::value_type |
x1 | mu::value_type |
dx | double |
vResult | vector<mu::value_type>& |
vFunctionValues | vector<mu::value_type>& |
bReturnFunctionPoints | bool |
Definition at line 109 of file command_implementations.cpp.
References date::abs(), mu::ParserBase::Eval(), NumeReKernel::getInstance(), NumeReKernel::getParser(), and mu::isnan().
Referenced by integrate(), and integrate2d().
|
static |
This static function performs an integration step using a trapezoidal approximation algorithm.
x | mu::value_type& |
x0 | mu::value_type |
dx | mu::value_type |
vResult | vector<mu::value_type>& |
vFunctionValues | vector<mu::value_type>& |
bReturnFunctionPoints | bool |
Definition at line 60 of file command_implementations.cpp.
References mu::ParserBase::Eval(), NumeReKernel::getInstance(), NumeReKernel::getParser(), mu::imag(), mu::isnan(), and mu::real().
Referenced by integrate(), and integrate2d().
|
static |
This static function is a helper for boneDetection to map/interpolate the calculated values to the final grid.
vAxis | const std::vector<double>& |
dInterpolVal | double |
bExtent | bool |
Definition at line 4094 of file command_implementations.cpp.
References intCast(), and mu::isnan().
Referenced by boneDetection(), and rotateTable().
|
static |
This function searches for the positions of all extrema, which are located in the selected interval.
sCmd | string& |
dVarAdress | mu::value_type* |
_parser | Parser& |
_option | const Settings& |
dLeft | mu::value_type |
dRight | mu::value_type |
dEps | double |
nRecursion | int |
The expression has to be setted in advance. The function performs recursions until the defined precision is reached.
Definition at line 2118 of file command_implementations.cpp.
References date::abs(), mu::Parser::Diff(), mu::ParserBase::Eval(), mu::ParserBase::GetExpr(), Linearize(), localizeExtremum(), mu::real(), and mu::ParserBase::SetExpr().
Referenced by findExtrema(), findZeroes(), and localizeExtremum().
|
static |
This function searches for the positions of all zeroes (roots), which are located in the selected interval.
sCmd | string& |
dVarAdress | mu::value_type* |
_parser | Parser& |
_option | const Settings& |
dLeft | mu::value_type |
dRight | mu::value_type |
dEps | double |
nRecursion | int |
The expression has to be setted in advance. The function performs recursions until the defined precision is reached.
Definition at line 2214 of file command_implementations.cpp.
References date::abs(), mu::ParserBase::Eval(), mu::ParserBase::GetExpr(), Linearize(), localizeZero(), mu::real(), and mu::ParserBase::SetExpr().
Referenced by findZeroes(), and localizeZero().
value_type parser_Random | ( | const value_type & | vRandMin, |
const value_type & | vRandMax | ||
) |
This function returns a uniformly distributed random number between both boundaries.
vRandMin | const value_type& |
vRandMax | const value_type& |
Definition at line 1834 of file functionimplementation.cpp.
References getRandGenInstance(), mu::isinf(), and mu::isnan().
Referenced by NumeReKernel::defineFunctions(), and particleSwarmOptimizer().
void particleSwarmOptimizer | ( | CommandLineParser & | cmdParser | ) |
This function implements a particle swarm optimizer in up to four dimensions (depending on the number of intervals defined). The optimizer has an adaptive velocity part, reducing the overall position variation of the particles over time.
cmdParser | CommandLineParser& |
Definition at line 4547 of file command_implementations.cpp.
References _defVars, mu::ParserBase::Eval(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), intCast(), IntervalSet::intervals, max, min, CommandLineParser::parseIntervals(), parser_Random(), mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), IntervalSet::size(), and DefaultVariables::vValue.
Referenced by cmd_pso().
bool readAudioFile | ( | CommandLineParser & | cmdParser | ) |
Reads either the audio file meta information or the whole audio file to memory.
cmdParser | CommandLineParser& |
Definition at line 3690 of file command_implementations.cpp.
References Indices::col, VectorIndex::front(), g_logger, Audio::getAudioFileByType(), CommandLineParser::getExprAsFileName(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), MemoryManager::getTable(), CommandLineParser::getTargetTable(), DetachedLogger::info(), Audio::Sample::leftOrMono, Memory::markModified(), VectorIndex::max(), VectorIndex::min(), MemoryManager::resizeTable(), Audio::Sample::right, Indices::row, CommandLineParser::setReturnValue(), VectorIndex::size(), VectorIndex::subidx(), Memory::writeData(), and Memory::writeDataDirectUnsafe().
Referenced by cmd_audioread().
|
static |
This static function re-evaluates the boundary expression and updates the internal variables correspondingly.
ivl | IntervalSet& |
y0 | double& |
y1 | double& |
sIntegrationExpression | const string& |
Definition at line 464 of file command_implementations.cpp.
References NumeReKernel::getInstance(), NumeReKernel::getParser(), and mu::ParserBase::SetExpr().
Referenced by integrate2d().
bool regularizeDataSet | ( | CommandLineParser & | cmdParser | ) |
This function regularizes the samples of a defined x-y-data array such that DeltaX is equal for every x.
CommandLineParser& | cmdParser |
Definition at line 3851 of file command_implementations.cpp.
References extractRange(), MemoryManager::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), intCast(), VectorIndex::OPEN_END, mu::real(), MemoryManager::setHeadLineElement(), SyntaxError::TABLE_DOESNT_EXIST, and MemoryManager::writeToTable().
Referenced by cmd_regularize().
std::string removeQuotationMarks | ( | const std::string & | sString | ) |
This function simply removes the surrounding quotation marks.
sString | const std::string& |
Definition at line 79 of file stringfunctions.hpp.
void rotateTable | ( | CommandLineParser & | cmdParser | ) |
This function rotates a table, an image or a datagrid around a specified angle.
cmdParser | CommandLineParser& |
Definition at line 4336 of file command_implementations.cpp.
References _lang, date::ceil(), Indices::col, DetachedLogger::debug(), Memory::extractRange(), g_logger, Language::get(), Memory::getCols(), MemoryManager::getCols(), CommandLineParser::getCommand(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), Memory::getLines(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), MemoryManager::getTable(), CommandLineParser::getTargetTable(), interpolateToGrid(), mu::isnan(), NumeReKernel::issueWarning(), M_PI, Memory::markModified(), VectorIndex::max(), max, min, NumeReKernel::print(), Memory::readMemInterpolated(), mu::real(), Memory::resizeMemory(), Point::rotate(), Indices::row, VectorIndex::setOpenEndIndex(), Memory::shrink(), MemoryManager::shrink(), VectorIndex::size(), VectorIndex::subidx(), Memory::writeDataDirect(), MemoryManager::writeToTable(), Point::x, and Point::y.
Referenced by cmd_rotate().
bool seekInAudioFile | ( | CommandLineParser & | cmdParser | ) |
Seek a position in an audiofile and extract a length of samples from it.
cmdParser | CommandLineParser& |
Definition at line 3779 of file command_implementations.cpp.
References Indices::col, VectorIndex::front(), g_logger, Audio::getAudioFileByType(), CommandLineParser::getFileParameterValue(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), MemoryManager::getTable(), CommandLineParser::getTargetTable(), DetachedLogger::info(), Audio::Sample::leftOrMono, Memory::markModified(), VectorIndex::max(), max, min, CommandLineParser::parseExprAsNumericalValues(), mu::real(), MemoryManager::resizeTable(), Audio::Sample::right, Indices::row, CommandLineParser::setReturnValue(), VectorIndex::size(), VectorIndex::subidx(), toString(), Memory::writeData(), and Memory::writeDataDirectUnsafe().
Referenced by cmd_seek().
bool shortTimeFourierAnalysis | ( | CommandLineParser & | cmdParser | ) |
This function performs the short-time fourier analysis on the passed data set.
cmdParser | CommandLineParser& |
Definition at line 3985 of file command_implementations.cpp.
References CommandLineParser::clearReturnValue(), Indices::col, DataAccessParser::evalIndices(), VectorIndex::front(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), MemoryManager::getHeadLineElement(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), CommandLineParser::getTargetTable(), intCast(), VectorIndex::INVALID, VectorIndex::isOpenEnd(), VectorIndex::max(), max, MemoryManager::max(), MemoryManager::min(), MemoryManager::resizeTable(), Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::setRange(), CommandLineParser::setReturnValue(), VectorIndex::size(), VectorIndex::subidx(), toString(), and MemoryManager::writeToTable().
Referenced by cmd_stfa().
void taylor | ( | CommandLineParser & | cmdParser | ) |
This function approximates the passed expression using Taylor's method.
cmdParser | CommandLineParser& |
The aproximated function is defined as a new custom function.
Definition at line 2305 of file command_implementations.cpp.
References _lang, date::abs(), NumeRe::SavitzkyGolayDiffFilter::apply(), containsStrings(), FunctionDefinitionManager::defineFunc(), mu::ParserBase::Eval(), findVariableInExpression(), Language::get(), CommandLineParser::getAllParametersWithValues(), CommandLineParser::getCommandLine(), NumeReKernel::getDefinitions(), CommandLineParser::getExpr(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), CommandLineParser::getParameterList(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getPointerToVariable(), Settings::getPrecision(), NumeReKernel::getSettings(), CommandLineParser::hasParam(), intCast(), integralFactorial(), SyntaxError::invalid_position, FunctionDefinitionManager::isDefined(), mu::isinf(), mu::isnan(), NumeReKernel::issueWarning(), LineBreak(), NumeReKernel::print(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), Settings::systemPrints(), and toString().
Referenced by cmd_taylor().
void urlExecute | ( | CommandLineParser & | cmdParser | ) |
This function implements the url command providing an interface to http(s) and (s)ftp URLs.
cmdParser | CommandLineParser& |
Definition at line 4700 of file command_implementations.cpp.
References SyntaxError::CANNOT_OPEN_TARGET, url::get(), CommandLineParser::getCommandLine(), CommandLineParser::getFileParameterValue(), CommandLineParser::getFileParameterValueForSaving(), CommandLineParser::getParameterValueAsString(), CommandLineParser::hasParam(), CommandLineParser::parseExprAsString(), url::put(), replaceAll(), CommandLineParser::setReturnValue(), toString(), date::detail::trunc(), SyntaxError::URL_ERROR, and url::Error::what().
Referenced by cmd_url().
bool writeAudioFile | ( | CommandLineParser & | cmdParser | ) |
This function creates a WAVE file from the selected data set.
cmdParser | CommandLineParser& |
Definition at line 3622 of file command_implementations.cpp.
References Indices::col, DataAccessParser::evalIndices(), VectorIndex::front(), Audio::getAudioFileByType(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getFileParameterValueForSaving(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), intCast(), VectorIndex::isOpenEnd(), max, MemoryManager::max(), MemoryManager::min(), Indices::row, VectorIndex::setRange(), and VectorIndex::size().
Referenced by cmd_audio().
DefaultVariables _defVars |
Definition at line 39 of file command_implementations.cpp.
Referenced by createDatagrid(), Plot::createPlotOrAnimation(), Plot::createSubPlotSet(), Plot::fillData(), integrate(), integrate2d(), Odesolver::odeFunction(), particleSwarmOptimizer(), Odesolver::solve(), and NumeReKernel::StartUp().