![]() |
GemaCoreLib
The GeMA Core library
|
Groups utilitary routines for working with vectors. More...
Functions | |
void | 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 | 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 | fillFromLuaTable (GmVector &v, LuaTable &t) |
Resizes and fills the vector v to receive the data stored in a lua table. | |
bool | fillFromLuaTable (GmVector &v, LuaTable &t, int n) |
Resizes and fills the vector v to receive the data stored in a lua table. More... | |
double | sqrDistance (const GmVector &a, const GmVector &b) |
Returns the squared distance between vectors a and b. | |
double | distance (const GmVector &a, const GmVector &b) |
Returns the distance between vectors a and b. | |
double | sqrNorm (const GmVector &v) |
Returns the squared norm of vector v. | |
double | 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 | isZero (const GmVector &a, double absTol) |
Check to see if a vector is zero using GmDoubleCmp::isZero over each component. | |
void | 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 | 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 | hasSharedMemory (GmVector &v) |
Is this vector operating over a shared memory (set by setVectorMemory())? | |
void | 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... | |
Groups utilitary routines for working with vectors.
GMC_API_EXPORT bool GmVectorUtils::fillFromLuaTable | ( | GmVector & | v, |
LuaTable & | t, | ||
int | n | ||
) |
Resizes and fills the vector v to receive the data stored in a lua table.
If n is different from -1 and the table has a size different from n, returns false, without filling v
|
inline |
Updates the memory area used internally by a vector. DANGEROUS. Should be used only by the bold ones who KNOWS what they are doing.
Makes the vector use the supplied memory and sets the vector size. To be minimally safe, accepts only an empty vector, without allocated memory, or a vector pointing to another external memory area.
|
inline |
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.
To be minimally safe, accepts only a vector pointing to another external memory area.