35 template <
class T1, 
class T2>
    38     return fabs(a - b) <= ((fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
    58     return lhs > rhs ? lhs - rhs : rhs - lhs;
    68 bool loadVector(std::istream& f, std::vector<int>& d);
    74 bool loadVector(std::istream& f, std::vector<double>& d);
    77     const std::vector<double>& inV, std::vector<double>& outV, 
int winSize,
    78     int numberOfSigmas = 2);
    83 template <
typename T, 
typename VECTOR>
    84 void linspace(T first, T last, 
size_t count, VECTOR& out_vector)
    88         out_vector.assign(count, last);
    93         out_vector.resize(count);
    94         const T incr = (last - first) / T(count - 1);
    96         for (
size_t i = 0; i < count; i++, c += incr) out_vector[i] = c;
   102 template <
class T, T STEP>
   105     std::vector<T> ret(length);
   106     if (!length) 
return ret;
   119 template <
class VEC1, 
class VEC2>
   123     const size_t N = v.size();
   124     for (
size_t i = 0; i < N; i++) total += 
square(v[i]);
   125     total = std::sqrt(total);
   129         out_v *= (1.0 / total);
   132         out_v.assign(v.size(), 0);
   144 template <
class VECTOR_OF_VECTORS, 
class VECTORLIKE>
   146     const size_t colIndex, 
const VECTOR_OF_VECTORS& 
data,
   147     VECTORLIKE& out_column)
   149     const size_t N = 
data.size();
   150     out_column.resize(N);
   151     for (
size_t i = 0; i < N; i++) out_column[i] = 
data[i][colIndex];
   176     const std::string& style = std::string(
"b"), 
size_t nEllipsePoints = 30);
   190     const std::string& style = std::string(
"b"), 
size_t nEllipsePoints = 30);
   201 template <
typename VECTOR_T, 
typename At, 
size_t N>
   204     static_assert(N != 0, 
"N!=0");
   206     for (
size_t i = 0; i < N; i++)
   207         v[i] = static_cast<typename VECTOR_T::Scalar>(theArray[i]);
   211 template <
typename T, 
typename At, 
size_t N>
   212 std::vector<T>& 
loadVector(std::vector<T>& v, At (&theArray)[N])
   214     static_assert(N != 0, 
"N!=0");
   216     for (
size_t i = 0; i < N; i++) v[i] = static_cast<T>(theArray[i]);
   233 template <
class TRIPLET>
   235     const std::string& sFile, std::vector<TRIPLET>& tri)
   237 #if defined(_MSC_VER) && \   238     (_MSC_VER >= 1400)  // Use a secure version in Visual Studio 2005+   240     if (0 != ::fopen_s(&f, sFile.c_str(), 
"wt")) f = 
nullptr;
   242     FILE* f = 
::fopen(sFile.c_str(), 
"wt");
   245     if (!f) 
return false;
   247     for (
size_t i = 0; i < tri.size(); i++)
   249             f, 
"%u %u %e\n", 1 + tri[i].row(), 1 + tri[i].col(),
 
int void fclose(FILE *f)
An OS-independent version of fclose. 
 
bool saveEigenSparseTripletsToFile(const std::string &sFile, std::vector< TRIPLET > &tri)
Saves to a plain-text file the nonzero entries of a Eigen sparse matrix, represented as a vector of t...
 
CMatrixDynamic< float > CMatrixFloat
Declares a matrix of float numbers (non serializable). 
 
double factorial(unsigned int n)
Computes the factorial of an integer number and returns it as a double value (internally it uses loga...
 
CVectorDynamic< double > CVectorDouble
 
void normalize(CONTAINER &c, Scalar valMin, Scalar valMax)
Scales all elements such as the minimum & maximum values are shifted to the given values...
 
bool loadVector(std::istream &f, std::vector< int > &d)
Loads one row of a text file as a numerical std::vector. 
 
uint64_t factorial64(unsigned int n)
Computes the factorial of an integer number and returns it as a 64-bit integer number. 
 
void linspace(T first, T last, size_t count, VECTOR &out_vector)
Generates an equidistant sequence of numbers given the first one, the last one and the desired number...
 
CVectorDynamic< float > CVectorFloat
 
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf. 
 
return_t square(const num_t x)
Inline function for the square of a number. 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
void extractColumnFromVectorOfVectors(const size_t colIndex, const VECTOR_OF_VECTORS &data, VECTORLIKE &out_column)
Extract a column from a vector of vectors, and store it in another vector. 
 
void medianFilter(const std::vector< double > &inV, std::vector< double > &outV, int winSize, int numberOfSigmas=2)
 
double mean(const CONTAINER &v)
Computes the mean value of a vector. 
 
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen. 
 
T absDiff(const T &lhs, const T &rhs)
Absolute difference between two numbers. 
 
std::string MATLAB_plotCovariance2D(const CMatrixFloat &cov22, const CVectorFloat &mean, float stdCount, const std::string &style=std::string("b"), size_t nEllipsePoints=30)
Generates a string with the MATLAB commands required to plot an confidence interval (ellipse) for a 2...
 
bool approximatelyEqual(T1 a, T1 b, T2 epsilon)
Compare 2 floats and determine whether they are equal. 
 
std::vector< T > sequenceStdVec(T first, size_t length)
Generates a sequence of values [first,first+STEP,first+2*STEP,...]. 
 
CMatrixDynamic< double > CMatrixDouble
Declares a matrix of double numbers (non serializable). 
 
static struct FontData data