GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmVectorUtils.h File Reference

Utilitary functions for working with vectors. More...

#include <armadillo>
#include <math.h>
#include "gmLog.h"
#include "gmDoubleCmp.h"
#include <assert.h>
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

namespace  GmVectorUtils
 Groups utilitary routines for working with vectors.
 

Functions

double GmVectorUtils::sqrNorm (const double *v, unsigned s)
 Returns the squared norm of vector v, with size s.
 
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.
 
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.
 
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.
 

Detailed Description

Utilitary functions for working with vectors.

Author
Carlos Augusto Teixeira Mendes
Date
june, 2015