util.cpp File Reference

Introduction

Implementation of the auxiliary functions.

Definition in file util.cpp.

Functions

void RandomQuaternion (Vector4 &e)
 Generates a random quaternion. More...
 
void Quat2Mat (Matrix3 &R, Vector4 &e)
 Quaternion to rotation matrix. More...
 
void RandomMatrix (Matrix3 &M, real noiseLevel, bool gaussian, default_random_engine &e)
 Generates a random matrix. More...
 
void TestMethod (ONMethod *method, unsigned int nRep, Matrix3 *N, double *res)
 Test a particular orthonomalization matrix. More...
 
void PrintResults (unsigned int nMethods, string *methodLabel, unsigned int nResults, string *resultLabel, unsigned int noiseTicks, noise &noiseLevel, double ***results)
 Prints the results of the evaluation. More...
 
void SaveResults (unsigned int nMethods, string *methodLabel, unsigned int nResults, string *resultLabel, bool gaussian, unsigned int noiseTicks, noise &noiseLevel, double ***results)
 Saves the results of the evaluation. More...
 

Function Documentation

◆ RandomQuaternion()

void RandomQuaternion ( Vector4 e)

This function returns points with a uniform distribution on the surface of a 4-sphere following the algorithm described in:

  • Marsaglia, G. "Choosing a Point from the Surface of a Sphere." Ann. Math. Stat. 43, 645-646, 1972.
Parameters
eThe generated quaternion.

Definition at line 19 of file util.cpp.

Referenced by main().

◆ Quat2Mat()

void Quat2Mat ( Matrix3 R,
Vector4 e 
)

This function returns the rotation matrix corresponding to a set of Euler parameters.

Parameters
RThe output rotation matrix.
eThe quaternion.

Definition at line 41 of file util.cpp.

References real.

Referenced by ApproxMethod(), CayleyMethod(), and main().

◆ RandomMatrix()

void RandomMatrix ( Matrix3 M,
real  noiseLevel,
bool  gaussian,
default_random_engine &  e 
)

This function returns a 3x3 matrix whose entries are random numbers uniformly distributed in the interval [-errorbound, errorbound].

Parameters
MThe output noise matrix.
noiseLevelThe width of the noise.
gaussiantrue to use Gaussian distribution.
eThe random engine.

Definition at line 78 of file util.cpp.

Referenced by main().

◆ TestMethod()

void TestMethod ( ONMethod method,
unsigned int  nRep,
Matrix3 N,
double *  res 
)

Test a particular orthonomalization matrix method evaluating its efficiency and its accuracy.

Parameters
methodThe method to evaluate.
nRepThe number of randomly generated matrix to use in the evaluation.
NThe (nRep) noisy matrices.
resThe table of results (
See also
MeanDstE, MaxDstE, MinDstE, MeanOrtoE, MaxOrtoE MinOrtoE, AverageT).

Definition at line 102 of file util.cpp.

References AverageT, MaxDstE, MaxOrtoE, MeanDstE, MeanOrtoE, MinDstE, and MinOrtoE.

Referenced by main().

◆ PrintResults()

void PrintResults ( unsigned int  nMethods,
string *  methodLabel,
unsigned int  nResults,
string *  resultLabel,
unsigned int  noiseTicks,
noise noiseLevel,
double ***  results 
)

Prints the statistics collected when evaluating the methods.

Parameters
nMethodsThe number of methods tested.
methodLabelA label identifying each method.
nResultsNumber of statistics collected for each method.
resultLabelA label identifying each statistic.
noiseTicksThe number of ticks in the noise scale.
noiseLevelThe level of noise for each tick.
resultsThe table with all the results. This includes the statistics for each method and noise tick.

Definition at line 145 of file util.cpp.

Referenced by main().

◆ SaveResults()

void SaveResults ( unsigned int  nMethods,
string *  methodLabel,
unsigned int  nResults,
string *  resultLabel,
bool  gaussian,
unsigned int  noiseTicks,
noise noiseLevel,
double ***  results 
)

Saves the statistics collected when evaluating the methods to a file. The name of the file is generated using the methodLabel parameter (one separate file is generated for each method).

The files are stored in the 'results' folder with extension csv.

Parameters
nMethodsThe number of methods tested.
methodLabelA label identifying each method.
nResultsNumber of statistics collected for each method.
resultLabelA label identifying each statistic.
gaussiantrue if we used Gaussian distributions for the noise.
noiseTicksThe number of ticks in the noise scale.
noiseLevelThe level of noise for each tick.
resultsThe table with all the results. This includes the statistics for each method and noise tick.

Definition at line 186 of file util.cpp.

References AverageT.

Referenced by main().