NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
muParserBase.cpp File Reference

This file contains the basic implementation of the muparser engine. More...

#include "muParserBase.h"
#include "muParserTemplateMagic.h"
#include "../../kernel.hpp"
#include "../utils/stringtools.hpp"
#include "../structures.hpp"
#include <cassert>
#include <cmath>
#include <memory>
#include <vector>
#include <deque>
#include <sstream>
#include <locale>
#include <omp.h>
Include dependency graph for muParserBase.cpp:

Go to the source code of this file.

Namespaces

namespace  mu
 Namespace for mathematical applications.
 

Functions

unsigned int getMatchingParenthesis (const StringView &)
 Returns the position of the closing parenthesis. More...
 
mu::value_type parser_Num (const mu::value_type *, int)
 This function returns the number of valid elements in its array. More...
 
mu::value_type parser_Cnt (const mu::value_type *, int)
 This functioon simply returns the number of elements in its array (even the invalid ones). More...
 
mu::value_type parser_and (const mu::value_type *, int)
 This function calculates the logical AND operation between all elements in the passed array. More...
 
mu::value_type parser_or (const mu::value_type *, int)
 This function calculates the logical OR operation between all elements in the passed array. More...
 
mu::value_type parser_Norm (const mu::value_type *, int)
 This function calculates the vector norm of the elements in the passed array. More...
 
mu::value_type parser_product (const mu::value_type *, int)
 This function calculates the product of all elements in the passed array. More...
 
mu::value_type parser_Sum (const mu::value_type *, int)
 This function summarizes all elements in the passed array. More...
 
mu::value_type parser_Avg (const mu::value_type *, int)
 This function calculates the average of all elements in passed array. More...
 
mu::value_type parser_Med (const mu::value_type *, int)
 This function calculates the median of the elements in the passed array. More...
 
mu::value_type parser_Pct (const mu::value_type *, int)
 This function calculates the selected percentile of the passed array. More...
 
mu::value_type parser_Std (const mu::value_type *, int)
 This function calculates the standard deviation of the elements in the passed array. More...
 
mu::value_type parser_compare (const mu::value_type *, int)
 This function searches for elements of a specified type in the passed array. More...
 
mu::value_type parser_Min (const mu::value_type *, int)
 This function calculates the minimal value of all elements in the passed array. More...
 
mu::value_type parser_Max (const mu::value_type *, int)
 This function calculates the maximal value of all elements in the passed array. More...
 
std::vector< double > mu::real (const std::vector< value_type > &vVec)
 
std::vector< double > mu::imag (const std::vector< value_type > &vVec)
 
value_type mu::rint (value_type v)
 
std::vector< value_typemu::parser_logtoidx (const value_type *v, int n)
 Adaption of the logtoidx() function for 1D data arrays. More...
 
std::vector< value_typemu::parser_idxtolog (const value_type *v, int n)
 Adaption of the idxtolog() function for 1D data arrays. More...
 
value_type mu::operator* (const value_type &__x, const value_type &__y)
 Custom implementation for the complex multiplication operator with a scalar optimization. More...
 
value_type mu::operator/ (const value_type &__x, const value_type &__y)
 Custom implementation for the complex division operator with a scalar optimization. More...
 
static bool mu::stepIsStillPossible (const mu::value_type &current, const mu::value_type &last, const mu::value_type &d)
 Determines, whether the passed step is still in valid range and therefore can be done to expand the vector. More...
 
static std::string mu::printVector (const valbuf_type &buffer, int nElems)
 Simple helper function to print the buffer's contents. More...
 
static bool mu::isDelim (char c)
 

Detailed Description

This file contains the basic implementation of the muparser engine.

Definition in file muParserBase.cpp.

Function Documentation

◆ getMatchingParenthesis()

unsigned int getMatchingParenthesis ( const StringView sLine)

Returns the position of the closing parenthesis.

Parameters
sLineStringView
Returns
unsigned int The position of the closing parenthesis

This function determines the type of the desired parenthesis by itself by using the first parenthesis-like character that might be found in the passed string. This function also considers quotation marks, so that parentheses in strings are not considered as matching. If the function does not find the matching parenthesis, it returns string::npos

Definition at line 414 of file tools.cpp.

References StringViewBase::find_first_of(), and StringViewBase::length().

Referenced by applyValueHeuristics(), FlowCtrl::calc(), FunctionDefinitionManager::call(), FlowCtrl::checkFlowControlArgument(), cmd_stats(), FlowCtrl::compile(), mu::ParserBase::compileVectorExpansion(), mu::ParserBase::compileVectors(), mu::ParserBase::compileVectorsInMultiArgFunc(), containsFreeOperators(), convertVectorToExpression(), Plot::createDataLegends(), createEveryDefinition(), createMafVectorName(), NumeRe::StringParser::createStack(), Plot::createStd3dPlot(), FunctionDefinition::decodeDefinition(), differentiate(), doc_ReplaceExprContentForHTML(), NumeRe::StringParser::eval(), evalMatOp(), NumeRe::StringLogicParser::evalStringLogic(), evaluateFittingParams(), Sorter::evaluateKeyList(), NumeReKernel::evaluateProcedureCalls(), Procedure::expandInlineProcedures(), extractFirstParameterStringValue(), Procedure::extractProcedureInformation(), NumeRe::StringExpression::findAssignmentOperator(), mu::ParserBase::FindMultiArgFunc(), NumeRe::StringFuncHandler::findNextFunction(), NumeRe::FindProcedureDefinition(), SearchController::FindProcedureDefinitionInLocalFile(), Documentation::getArgAtPos(), NumeReEditor::GetCurrentArgument(), getFittingParameters(), getIndices(), getIntervalForSearchFunctions(), getMafAccessString(), getPositionOfFirstDelimiter(), NumeRe::StringLogicParser::getStringTernaryExpression(), GenericTerminal::handle_calltip(), NumeReKernel::handleToCmd(), FunctionDefinition::importFunction(), integrate(), IntervalSet::IntervalSet(), isClusterCandidate(), NumeRe::StringVarFactory::isNumericCandidate(), NumeRe::StringParser::numToString(), CommandLineParser::parse(), parseCmdArg(), Procedure::ProcCalc(), ProcedureElement::ProcedureElement(), Procedure::procedureInterface(), readAndParseIntervals(), NumeRe::realignLangString(), removeObsoleteParentheses(), replaceDataEntities(), replaceEntityOccurence(), ProcedureVarFactory::resolveArguments(), Plot::separateFunctionsAndData(), FlowCtrl::setCommand(), FunctionDefinition::splitAndValidateArguments(), strfnc_getmatchingparens(), and Procedure::writeProcedure().

Here is the call graph for this function:

◆ parser_and()

mu::value_type parser_and ( const value_type vElements,
int  nElements 
)

This function calculates the logical AND operation between all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 997 of file functionimplementation.cpp.

References mu::isnan().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Avg()

mu::value_type parser_Avg ( const value_type vElements,
int  nElements 
)

This function calculates the average of all elements in passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 1157 of file functionimplementation.cpp.

References parser_Num(), and parser_Sum().

Referenced by parser_Std().

Here is the call graph for this function:

◆ parser_Cnt()

mu::value_type parser_Cnt ( const value_type vElements,
int  nElements 
)

This functioon simply returns the number of elements in its array (even the invalid ones).

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 765 of file functionimplementation.cpp.

Referenced by NumeReKernel::defineFunctions().

◆ parser_compare()

mu::value_type parser_compare ( const value_type vElements,
int  nElements 
)

This function searches for elements of a specified type in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 891 of file functionimplementation.cpp.

References intCast(), mu::isinf(), mu::isnan(), and mu::real().

Referenced by NumeReKernel::defineFunctions(), parser_MaxPos(), and parser_MinPos().

Here is the call graph for this function:

◆ parser_Max()

mu::value_type parser_Max ( const value_type vElements,
int  nElements 
)

This function calculates the maximal value of all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 1207 of file functionimplementation.cpp.

References mu::isnan(), max, and mu::real().

Referenced by mu::parser_idxtolog(), and parser_MaxPos().

Here is the call graph for this function:

◆ parser_Med()

mu::value_type parser_Med ( const value_type vElements,
int  nElements 
)

This function calculates the median of the elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 851 of file functionimplementation.cpp.

References Memory::med(), and Memory::writeData().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Min()

mu::value_type parser_Min ( const value_type vElements,
int  nElements 
)

This function calculates the minimal value of all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 1172 of file functionimplementation.cpp.

References mu::isnan(), min, and mu::real().

Referenced by parser_MinPos().

Here is the call graph for this function:

◆ parser_Norm()

mu::value_type parser_Norm ( const value_type vElements,
int  nElements 
)

This function calculates the vector norm of the elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 828 of file functionimplementation.cpp.

References mu::isnan().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Num()

mu::value_type parser_Num ( const value_type vElements,
int  nElements 
)

This function returns the number of valid elements in its array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 741 of file functionimplementation.cpp.

References mu::isinf(), and mu::isnan().

Referenced by NumeReKernel::defineFunctions(), parser_Avg(), and parser_Std().

Here is the call graph for this function:

◆ parser_or()

mu::value_type parser_or ( const value_type vElements,
int  nElements 
)

This function calculates the logical OR operation between all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 1019 of file functionimplementation.cpp.

References mu::isnan().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Pct()

mu::value_type parser_Pct ( const value_type vElements,
int  nElements 
)

This function calculates the selected percentile of the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 871 of file functionimplementation.cpp.

References Memory::pct(), and Memory::writeData().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_product()

mu::value_type parser_product ( const value_type vElements,
int  nElements 
)

This function calculates the product of all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 805 of file functionimplementation.cpp.

References mu::isnan().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Std()

mu::value_type parser_Std ( const value_type vElements,
int  nElements 
)

This function calculates the standard deviation of the elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 781 of file functionimplementation.cpp.

References mu::isnan(), parser_Avg(), and parser_Num().

Referenced by NumeReKernel::defineFunctions().

Here is the call graph for this function:

◆ parser_Sum()

mu::value_type parser_Sum ( const value_type vElements,
int  nElements 
)

This function summarizes all elements in the passed array.

Parameters
vElementsconst value_type*
nElementsint
Returns
value_type

Definition at line 1134 of file functionimplementation.cpp.

References mu::isnan().

Referenced by parser_Avg().

Here is the call graph for this function: