NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
VectorIndex Class Reference

This class abstracts all the index logics, i.e. the logical differences between single indices and indices described by a vector. More...

#include <structures.hpp>

Collaboration diagram for VectorIndex:

Public Types

enum  { INVALID = -1 , OPEN_END = -2 , STRING = -3 }
 

Public Member Functions

 VectorIndex ()
 Default constructor. More...
 
 VectorIndex (const VectorIndex &vIndex)
 Copy constructor. More...
 
 VectorIndex (VectorIndex &&vIndex)
 VectorIndex move constructor. More...
 
 VectorIndex (const mu::value_type *indices, int nResults, int unused)
 Constructor from an array of doubles. The third argument is used only to avoid misinterpretation from the compiler. More...
 
 VectorIndex (int nStart, int nEnd=INVALID)
 Constructor for single indices. More...
 
 VectorIndex (const std::vector< int > &vIndex)
 Constructor from a STL vector. More...
 
VectorIndexoperator= (const VectorIndex &vIndex)
 Assignment operator overload for the same type. More...
 
VectorIndexoperator= (const std::vector< int > &vIndex)
 Assignment operator overload for STL vectors. More...
 
VectorIndex subidx (size_t pos, size_t nLen=std::string::npos) const
 This member function returns a subset of the internal stored index just like the std::string::substr() member function. More...
 
void linearize ()
 This member function linearizes the contents of a vector-described index set. The vectorial information is lost after using this function and the index will be described by single indices constructed from the minimal and maximal index values. More...
 
int operator[] (size_t n) const
 Overload for the access operator. Redirects the control to the private getIndex() member function. More...
 
size_t size () const
 This member function returns the size of the indices stored in this class. More...
 
size_t numberOfNodes () const
 This member function returns the number of nodes describing the index set, which is stored internally. More...
 
bool isOrdered () const
 This member function determines, whether the single indices are in the correct order. More...
 
bool isExpanded () const
 This member function determines, whether the indices are calculated or actual vectorial indices. More...
 
void setIndex (size_t nthIndex, int nVal)
 This member function can be used to set the index at a special position. This will expand the internal storage and switch from single indices to vectorial ones automatically. More...
 
void push_back (int nVal)
 This function will append the passed index value at the end of the index vector. The internal storage is expanded first, if necessary. More...
 
void append (const std::vector< int > &vVector)
 This function will append the passed vector to the end of the index vector. The internal storage is expanded first, if necessary. More...
 
void append (const VectorIndex &vIndex)
 This function will append the passed VectorIndex to the end of the index vector. The internal storage is expanded first, if necessary. This function is an overload for convenience. More...
 
void prepend (const std::vector< int > &vVector)
 This function will prepend the passed vector before the beginning of the index vector. The internal storage is expanded first, if necessary. More...
 
void prepend (const VectorIndex &vIndex)
 This function will append the passed VectorIndex before the beginning of the index vector. The internal storage is expanded first, if necessary. This function is an overload for convenience. More...
 
std::vector< int > getVector () const
 This member function returns a STL vector, which will resemble the indices stored internally. This includes that the single indices are expanded in the returned vector. More...
 
int max () const
 This function calculates the maximal index value obtained from the values stored internally. More...
 
int min () const
 This member function calculates the minimal index value obtained from the values stored internally. More...
 
bool isValid () const
 This member function determines, whether the internal index set is valid. More...
 
bool isOpenEnd () const
 This member function determines, whether the internal index set has an open end. More...
 
bool isString () const
 This member function determines, whether the internal index set referres to the table headlines. More...
 
int & front ()
 This member function returns a reference to the first index value stored internally. More...
 
int & back ()
 This member function returns a reference to the final index value stored internally. More...
 
const int & front () const
 This member function returns a const reference to the first index value stored internally. More...
 
const int & back () const
 This member function returns a const reference to the final index value stored internally. More...
 
int last () const
 This member function returns the last index value, which can be reached by the values stored internally (this is most probably different from the final value). More...
 
void setRange (int nMin, int nMax)
 This member function can be used to force the indices stored internally to be in a defined interval. If the values are already in a smaller interval, nothing happens. More...
 
void setOpenEndIndex (int nLast) const
 This member function can be used to replace the open end state with a defined index value although the VectorIndex instance was passed as const ref. More...
 
std::string to_string () const
 This member function converts the vector indexes contents into a human-readable string representation. More...
 

Private Member Functions

int getIndex (size_t n) const
 This private memnber function calculates the index corresponding to the selected position n. Otherwise simply return the n-th vector index. More...
 

Private Attributes

std::vector< int > vStorage
 
bool expand
 

Detailed Description

This class abstracts all the index logics, i.e. the logical differences between single indices and indices described by a vector.

Definition at line 41 of file structures.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
INVALID 
OPEN_END 
STRING 

Definition at line 89 of file structures.hpp.

Constructor & Destructor Documentation

◆ VectorIndex() [1/6]

VectorIndex::VectorIndex ( )
inline

Default constructor.

Definition at line 101 of file structures.hpp.

References expand, INVALID, and vStorage.

Referenced by subidx().

◆ VectorIndex() [2/6]

VectorIndex::VectorIndex ( const VectorIndex vIndex)
inline

Copy constructor.

Parameters
vIndexconst VectorIndex&

Definition at line 113 of file structures.hpp.

◆ VectorIndex() [3/6]

VectorIndex::VectorIndex ( VectorIndex &&  vIndex)
inline

VectorIndex move constructor.

Parameters
vIndexVectorIndex&&

Definition at line 123 of file structures.hpp.

References vStorage.

◆ VectorIndex() [4/6]

VectorIndex::VectorIndex ( const mu::value_type indices,
int  nResults,
int  unused 
)
inline

Constructor from an array of doubles. The third argument is used only to avoid misinterpretation from the compiler.

Parameters
indicesconst mu::value_type*
nResultsint
unusedint

Definition at line 138 of file structures.hpp.

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

Here is the call graph for this function:

◆ VectorIndex() [5/6]

VectorIndex::VectorIndex ( int  nStart,
int  nEnd = INVALID 
)
inline

Constructor for single indices.

Parameters
nStartint
nEndint

Definition at line 158 of file structures.hpp.

References expand, and vStorage.

◆ VectorIndex() [6/6]

VectorIndex::VectorIndex ( const std::vector< int > &  vIndex)
inline

Constructor from a STL vector.

Parameters
vIndexconst std::vector<int>&

Definition at line 170 of file structures.hpp.

References expand, INVALID, and vStorage.

Member Function Documentation

◆ append() [1/2]

void VectorIndex::append ( const std::vector< int > &  vVector)
inline

This function will append the passed vector to the end of the index vector. The internal storage is expanded first, if necessary.

Parameters
vVectorconst std::vector<int>&
Returns
void

Definition at line 451 of file structures.hpp.

References expand, getVector(), and vStorage.

Referenced by append(), matrixFilter(), and Memory::smooth().

Here is the call graph for this function:

◆ append() [2/2]

void VectorIndex::append ( const VectorIndex vIndex)
inline

This function will append the passed VectorIndex to the end of the index vector. The internal storage is expanded first, if necessary. This function is an overload for convenience.

Parameters
vIndexconst VectorIndex&
Returns
void

Definition at line 473 of file structures.hpp.

References append(), expand, getVector(), and vStorage.

Here is the call graph for this function:

◆ back() [1/2]

int & VectorIndex::back ( )
inline

This member function returns a reference to the final index value stored internally.

Returns
int&

Definition at line 653 of file structures.hpp.

References vStorage.

Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), evaluateTargetOptionInCommand(), getDataForFit(), NumeRe::StringParser::getDataForString(), getIndices(), sortClusters(), sortStrings(), and NumeRe::StringParser::storeStringToDataObjects().

◆ back() [2/2]

const int & VectorIndex::back ( ) const
inline

This member function returns a const reference to the final index value stored internally.

Returns
const int&

Definition at line 679 of file structures.hpp.

References vStorage.

◆ front() [1/2]

int & VectorIndex::front ( )
inline

This member function returns a reference to the first index value stored internally.

Returns
int&

Definition at line 640 of file structures.hpp.

References vStorage.

Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::Cluster::assignResults(), NumeRe::Cluster::assignVectorResults(), boneDetection(), calculate1dFFT(), calculate2dFFT(), cmd_delete(), createDatagrid(), createHist1D(), createOutputForHist1D(), createOutputForHist2D(), ValueColumn::deleteElements(), DateTimeColumn::deleteElements(), LogicalColumn::deleteElements(), StringColumn::deleteElements(), CategoricalColumn::deleteElements(), differentiate(), DataAccessParser::evalIndices(), evaluateTargetOptionInCommand(), evaluateTransposeForDataOperation(), Plot::extractDataValues(), extractRange(), fastWaveletTransform(), Memory::findValidBoundary(), getDataForFit(), NumeRe::StringParser::getDataForString(), getDataFromObject(), getIndices(), handleArgumentForIndices(), handleIndexVectors(), handleSingleCasualIndex(), Memory::importTable(), StringMemory::maxString(), StringMemory::minString(), performMatrixOperation(), readAudioFile(), readImage(), replaceDataEntities(), Memory::resample(), Memory::retouch2D(), seekInAudioFile(), shortTimeFourierAnalysis(), Memory::smooth(), Memory::smoothingWindow1D(), Memory::smoothingWindow2D(), Odesolver::solve(), sortClusters(), sortData(), sortStrings(), NumeRe::StringParser::storeStringToDataObjects(), NumeRe::StringParser::storeStringToStringObject(), StringMemory::sumString(), writeAudioFile(), Memory::writeData(), and Memory::writeSingletonData().

◆ front() [2/2]

const int & VectorIndex::front ( ) const
inline

This member function returns a const reference to the first index value stored internally.

Returns
const int&

Definition at line 666 of file structures.hpp.

References vStorage.

◆ getIndex()

int VectorIndex::getIndex ( size_t  n) const
inlineprivate

This private memnber function calculates the index corresponding to the selected position n. Otherwise simply return the n-th vector index.

Parameters
nsize_t
Returns
int

Definition at line 57 of file structures.hpp.

References expand, INVALID, OPEN_END, and vStorage.

Referenced by getVector(), operator[](), subidx(), and to_string().

◆ getVector()

std::vector< int > VectorIndex::getVector ( ) const
inline

This member function returns a STL vector, which will resemble the indices stored internally. This includes that the single indices are expanded in the returned vector.

Returns
std::vector<int>

Definition at line 531 of file structures.hpp.

References expand, getIndex(), size(), and vStorage.

Referenced by append(), prepend(), push_back(), and Memory::smooth().

Here is the call graph for this function:

◆ isExpanded()

◆ isOpenEnd()

◆ isOrdered()

bool VectorIndex::isOrdered ( ) const
inline

This member function determines, whether the single indices are in the correct order.

This function won't return correct results for already expanded vectors.

Returns
bool

Definition at line 361 of file structures.hpp.

References INVALID, isValid(), OPEN_END, and vStorage.

Referenced by Memory::and_func(), Memory::calculateStats(), Memory::cmp(), Memory::copyElementsInto(), Memory::med(), Memory::or_func(), Memory::pct(), Memory::readMem(), Memory::readMemAsString(), Memory::readMixedMem(), and Memory::xor_func().

Here is the call graph for this function:

◆ isString()

bool VectorIndex::isString ( ) const
inline

This member function determines, whether the internal index set referres to the table headlines.

Returns
bool

Definition at line 627 of file structures.hpp.

References STRING, and vStorage.

Referenced by replaceDataEntities(), and NumeRe::StringParser::storeStringToDataObjects().

◆ isValid()

bool VectorIndex::isValid ( ) const
inline

This member function determines, whether the internal index set is valid.

Returns
bool

Definition at line 601 of file structures.hpp.

References INVALID, and vStorage.

Referenced by expandIndexVectors(), NumeRe::StringParser::getDataForString(), handleCasualIndices(), isOrdered(), isValidIndexSet(), numberOfNodes(), Memory::resample(), Memory::retouch(), size(), Memory::smooth(), and NumeRe::StringParser::storeStringToStringObject().

◆ last()

◆ linearize()

void VectorIndex::linearize ( )
inline

This member function linearizes the contents of a vector-described index set. The vectorial information is lost after using this function and the index will be described by single indices constructed from the minimal and maximal index values.

Returns
void

Definition at line 276 of file structures.hpp.

References expand, max(), min(), and vStorage.

Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), Memory::resample(), and Memory::retouch().

Here is the call graph for this function:

◆ max()

int VectorIndex::max ( ) const
inline

This function calculates the maximal index value obtained from the values stored internally.

Returns
int

Definition at line 558 of file structures.hpp.

References expand, isOpenEnd(), max, OPEN_END, and vStorage.

Referenced by Memory::importTable(), linearize(), performMatrixOperation(), readAudioFile(), readImage(), rotateTable(), seekInAudioFile(), and shortTimeFourierAnalysis().

Here is the call graph for this function:

◆ min()

int VectorIndex::min ( ) const
inline

This member function calculates the minimal index value obtained from the values stored internally.

Returns
int

Definition at line 576 of file structures.hpp.

References expand, isOpenEnd(), min, and vStorage.

Referenced by Memory::deleteBulk(), linearize(), readAudioFile(), and readImage().

Here is the call graph for this function:

◆ numberOfNodes()

size_t VectorIndex::numberOfNodes ( ) const
inline

This member function returns the number of nodes describing the index set, which is stored internally.

This is used in cases, where the indices will be interpreted slightly different than in the usual cases.

Returns
size_t

Definition at line 340 of file structures.hpp.

References INVALID, isValid(), and vStorage.

Referenced by Plot::extractDataValues(), extractRange(), getIndicesForPlotAndFit(), and handleArgumentForIndices().

Here is the call graph for this function:

◆ operator=() [1/2]

VectorIndex & VectorIndex::operator= ( const std::vector< int > &  vIndex)
inline

Assignment operator overload for STL vectors.

Parameters
vIndexconst std::vector<int>&
Returns
VectorIndex&

Definition at line 207 of file structures.hpp.

References expand, and vStorage.

◆ operator=() [2/2]

VectorIndex & VectorIndex::operator= ( const VectorIndex vIndex)
inline

Assignment operator overload for the same type.

Parameters
vIndexconst VectorIndex&
Returns
VectorIndex&

Definition at line 192 of file structures.hpp.

References expand, and vStorage.

◆ operator[]()

int VectorIndex::operator[] ( size_t  n) const
inline

Overload for the access operator. Redirects the control to the private getIndex() member function.

Parameters
nsize_t
Returns
int

Definition at line 298 of file structures.hpp.

References getIndex().

Here is the call graph for this function:

◆ prepend() [1/2]

void VectorIndex::prepend ( const std::vector< int > &  vVector)
inline

This function will prepend the passed vector before the beginning of the index vector. The internal storage is expanded first, if necessary.

Parameters
vVectorconst std::vector<int>&
Returns
void

Definition at line 491 of file structures.hpp.

References expand, getVector(), and vStorage.

Referenced by Plot::extractDataValues(), matrixFilter(), prepend(), and Memory::smooth().

Here is the call graph for this function:

◆ prepend() [2/2]

void VectorIndex::prepend ( const VectorIndex vIndex)
inline

This function will append the passed VectorIndex before the beginning of the index vector. The internal storage is expanded first, if necessary. This function is an overload for convenience.

Parameters
vIndexconst VectorIndex&
Returns
void

Definition at line 513 of file structures.hpp.

References expand, getVector(), prepend(), and vStorage.

Here is the call graph for this function:

◆ push_back()

void VectorIndex::push_back ( int  nVal)
inline

This function will append the passed index value at the end of the index vector. The internal storage is expanded first, if necessary.

Parameters
nValint
Returns
void

Definition at line 430 of file structures.hpp.

References expand, getVector(), and vStorage.

Here is the call graph for this function:

◆ setIndex()

void VectorIndex::setIndex ( size_t  nthIndex,
int  nVal 
)
inline

This member function can be used to set the index at a special position. This will expand the internal storage and switch from single indices to vectorial ones automatically.

Parameters
nthIndexsize_t
nValint
Returns
void

Definition at line 394 of file structures.hpp.

References expand, INVALID, OPEN_END, and vStorage.

Referenced by getIndices(), handleCasualIndices(), and handleSingleCasualIndex().

◆ setOpenEndIndex()

◆ setRange()

◆ size()

size_t VectorIndex::size ( ) const
inline

This member function returns the size of the indices stored in this class.

It will return either the size of the stored vectorial indices or the calculated size for expanded single indices.

Returns
size_t

Definition at line 314 of file structures.hpp.

References date::abs(), expand, INVALID, isValid(), OPEN_END, and vStorage.

Referenced by NumeRe::Cluster::and_func(), Memory::and_func(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::Cluster::assignVectorResults(), NumeRe::Cluster::avg(), boneDetection(), calculate1dFFT(), calculate2dFFT(), calculateChiMap(), calculateDataForCenterPlot(), calculateHist1dData(), Memory::calculateStats(), calculateXYHist(), cmd_show(), MemoryManager::cmp(), Memory::cmp(), NumeRe::Cluster::cmp(), NumeRe::Cluster::cnt(), Memory::cnt(), Memory::convertColumns(), ValueColumn::copy(), DateTimeColumn::copy(), LogicalColumn::copy(), StringColumn::copy(), CategoricalColumn::copy(), Memory::copyElementsInto(), Memory::countIfEqual(), createDatagrid(), createHist1D(), createHist2D(), createOutputForHist2D(), Memory::deleteBulk(), ValueColumn::deleteElements(), DateTimeColumn::deleteElements(), LogicalColumn::deleteElements(), StringColumn::deleteElements(), CategoricalColumn::deleteElements(), NumeRe::Cluster::deleteItems(), differentiate(), evalMatOp(), evaluateFittingParams(), evaluateTransposeForDataOperation(), Plot::extractDataValues(), Memory::extractRange(), Memory::extractTable(), Memory::getCategoryList(), MemoryManager::getColElements(), Memory::getCovariance(), getDataForFit(), NumeRe::StringParser::getDataForString(), getDataFromObject(), Memory::getHeadLineElement(), getMatrixElements(), Memory::getPearsonCorr(), getSamplesForDatagrid(), Memory::getSpearmanCorr(), Memory::getType(), TableColumn::getValue(), TableColumn::getValueAsInternalString(), TableColumn::getValueAsString(), getVector(), Memory::getZScore(), Memory::importTable(), NumeRe::Cluster::insertDataInArray(), integrateSingleDimensionData(), NumeRe::Cluster::max(), Memory::max(), Memory::maxpos(), StringMemory::maxString(), NumeRe::Cluster::med(), Memory::med(), NumeRe::Cluster::min(), Memory::min(), Memory::minpos(), StringMemory::minString(), NumeRe::Cluster::norm(), Memory::norm(), NumeRe::Cluster::num(), Memory::num(), NumeRe::Cluster::or_func(), Memory::or_func(), parser_declareDataMatrixValuesForIndices(), MemoryManager::pct(), Memory::pct(), NumeRe::Cluster::pct(), performDataOperation(), plugin_histogram(), plugin_random(), plugin_statistics(), NumeRe::Cluster::prd(), Memory::prd(), readAudioFile(), Memory::readMem(), Memory::readMemAsMatrix(), Memory::readMemAsString(), Memory::readMixedMem(), replaceDataEntities(), Memory::resample(), MemoryManager::resolveMAF(), Memory::retouch(), Memory::retouch1D(), rotateTable(), seekInAudioFile(), Memory::setCategories(), TableColumn::setValue(), shortTimeFourierAnalysis(), Memory::size(), Memory::smooth(), Memory::smoothingWindow1D(), Memory::smoothingWindow2D(), Odesolver::solve(), NumeRe::Cluster::std(), Memory::std(), NumeRe::StringParser::storeStringToDataObjects(), NumeRe::StringParser::storeStringToStringObject(), NumeRe::Cluster::strmax(), NumeRe::Cluster::strmin(), NumeRe::Cluster::strsum(), subidx(), NumeRe::Cluster::sum(), Memory::sum(), StringMemory::sumString(), to_string(), writeAudioFile(), Memory::writeData(), Memory::writeSingletonData(), NumeRe::Cluster::xor_func(), and Memory::xor_func().

Here is the call graph for this function:

◆ subidx()

VectorIndex VectorIndex::subidx ( size_t  pos,
size_t  nLen = std::string::npos 
) const
inline

This member function returns a subset of the internal stored index just like the std::string::substr() member function.

Single indices are not expanded therefore the storage space used for the newly created index won't be larger than the current one. However, already expanded indices will result in an expanded subindex vector.

Note
A length of 0 or 1 will both create a VectorIndex with only one valid entry (the first).
Parameters
possize_t
nLensize_t
Returns
VectorIndex

Definition at line 238 of file structures.hpp.

References expand, getIndex(), size(), VectorIndex(), and vStorage.

Referenced by boneDetection(), createDatagrid(), createHist1D(), createHist2D(), Plot::extractDataValues(), Memory::getCovariance(), getDataForFit(), getDataGridDimensions(), Memory::getPearsonCorr(), Memory::getSpearmanCorr(), performMatrixOperation(), readAudioFile(), readImage(), replaceDataEntities(), Memory::resample(), Memory::retouch(), rotateTable(), seekInAudioFile(), shortTimeFourierAnalysis(), Memory::smooth(), and NumeRe::StringParser::storeStringToDataObjects().

Here is the call graph for this function:

◆ to_string()

std::string VectorIndex::to_string ( ) const
inline

This member function converts the vector indexes contents into a human-readable string representation.

Returns
std::string

Definition at line 770 of file structures.hpp.

References expand, getIndex(), INVALID, OPEN_END, size(), STRING, toString(), and vStorage.

Referenced by FlowCtrl::calc(), FlowCtrl::compile(), createDatagrid(), differentiate(), evaluateFittingParams(), evaluateTargetOptionInCommand(), expandIndexVectors(), Plot::extractDataValues(), getAccessParserForPlotAndFit(), DataAccessParser::getIndexString(), getMatrixElements(), getSamplesForDatagrid(), handleCachedDataAccess(), handleCasualIndices(), NumeReKernel::MainLoop(), performMatrixOperation(), Procedure::ProcCalc(), replaceDataEntities(), Memory::resample(), Memory::smooth(), and sortData().

Here is the call graph for this function:

Member Data Documentation

◆ expand

bool VectorIndex::expand
private

◆ vStorage


The documentation for this class was generated from the following file: