range_search_utils.hpp File Reference
Include dependency graph for range_search_utils.hpp:

Go to the source code of this file.

Functions

void CheckMatrices (std::vector< std::vector< double >> &vec1, std::vector< std::vector< double >> &vec2, const double tolerance=1e-3)
 Check that 2 matrices of type vector<vector<double>> are close to equal, using the given tolerance. More...

 
void CheckMatrices (std::vector< std::vector< size_t >> &vec1, std::vector< std::vector< size_t >> &vec2)
 Check that 2 matrices of type vector<vector<size_t>> are equal. More...

 
std::string ModelToString (RSModel *model)
 Convert a model to a string using the text_oarchive of cereal. More...

 
template
<
typename
T
>
std::vector< std::vector< T > > ReadData (const std::string &filename)
 Load a CSV file into a vector of vector with a templated datatype. More...

 

Detailed Description

Author
Niteya Shah

Helper functions used in the execution of the Range Search test.

mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.

Definition in file range_search_utils.hpp.

Function Documentation

◆ CheckMatrices() [1/2]

void CheckMatrices ( std::vector< std::vector< double >> &  vec1,
std::vector< std::vector< double >> &  vec2,
const double  tolerance = 1e-3 
)
inline

Check that 2 matrices of type vector<vector<double>> are close to equal, using the given tolerance.

Parameters
vec1First vector to compare.
vec2Second vector to compare.
toleranceAllowed tolerance for values.

Definition at line 41 of file range_search_utils.hpp.

◆ CheckMatrices() [2/2]

void CheckMatrices ( std::vector< std::vector< size_t >> &  vec1,
std::vector< std::vector< size_t >> &  vec2 
)
inline

Check that 2 matrices of type vector<vector<size_t>> are equal.

Parameters
vec1First vector to compare.
vec2Second vector to compare.

Definition at line 64 of file range_search_utils.hpp.

◆ ModelToString()

std::string ModelToString ( RSModel *  model)
inline

Convert a model to a string using the text_oarchive of cereal.

Parameters
modelRSModel to be converted to string.

Definition at line 25 of file range_search_utils.hpp.

References CEREAL_POINTER.

◆ ReadData()

std::vector<std::vector<T> > ReadData ( const std::string &  filename)

Load a CSV file into a vector of vector with a templated datatype.


Any ',' characters are stripped from the input; lines are split on '
' and elements of each line are split on spaces.

Parameters
filenameName of the file to load.

Definition at line 88 of file range_search_utils.hpp.