GemaCoreLib
The GeMA Core library
Namespaces | Macros | Typedefs | Functions
gmVectorUtils.h File Reference

Utilitary functions for working with vectors. More...

#include <math.h>
#include "gmLog.h"
#include "gmDoubleCmp.h"
#include <assert.h>
#include <armadillo>
Include dependency graph for gmVectorUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 GmVectorUtils
 Groups utilitary routines for working with vectors.
 

Typedefs

typedef arma::vec GmVector
 The basic type for a GeMA vector object. Currently based on an Armadillo vector.
 

Functions

double GmVectorUtils::sqrDistance (const GmVector &a, const GmVector &b)
 Returns the squared distance between vectors a and b.
 
double GmVectorUtils::distance (const GmVector &a, const GmVector &b)
 Returns the distance between vectors a and b.
 
double GmVectorUtils::sqrNorm (const GmVector &v)
 Returns the squared norm of vector v.
 
double GmVectorUtils::equal (const GmVector &a, const GmVector &b, double relTol=GM_DOUBLECMP_RELTOL, double absTol=GM_DOUBLECMP_ABSTOL)
 Check to see if two vectors are equal comparing values using GmDoubleCmp::equal.
 
double GmVectorUtils::isZero (const GmVector &a, double absTol)
 Check to see if a vector is zero using GmDoubleCmp::isZero over each component.
 
void GmVectorUtils::setVectorMemory (GmVector &v, double *data, int nlin)
 Updates the memory area used internally by a vector. DANGEROUS. Should be used only by the bold ones who KNOWS what they are doing. More...
 
void GmVectorUtils::resetVectorMemory (GmVector &v)
 Updates a vector that was prepared with setVectorMemory() to a common empty column vector. If the vector is already a common vector, resets it AND sets its memory pointer to NULL to become compatible with the checks by setVectorMemory()
 
bool GmVectorUtils::hasSharedMemory (GmVector &v)
 Is this vector operating over a shared memory (set by setVectorMemory())?
 
void GmVectorUtils::setVectorSize (GmVector &v, int nlin)
 Updates the logical vector size WITHOUT changin the used memory area. DANGEROUS. Should be used only by the bold ones who KNOWS what they are doing. More...
 
void GmVectorUtils::print (const GmVector &v, const GmLogCategory &logger, GmLogLevel level, int fieldWidth, char format, int precision)
 Prints the vector using the specified logger, level and precision fields. Values are separated by spaces.
 
QString GmVectorUtils::toString (const GmVector &v, int fieldWidth, char format, int precision, bool noBraces)
 Serializes the vector to a string using the specified precision fields. Coordinates are surrounded by [] (unless noBraces is true) and values separated by ', '.
 
void GmVectorUtils::fillFromLuaTable (GmVector &v, LuaTable &t)
 Resizes and fills the vector v to receive the data stored in a lua table.
 
bool GmVectorUtils::fillFromLuaTable (GmVector &v, LuaTable &t, int n)
 Resizes and fills the vector v to receive the data stored in a lua table. More...
 

Detailed Description

Utilitary functions for working with vectors.

Author
Carlos Augusto Teixeira Mendes
Date
june, 2015