13#ifndef ML_LINEAR_ALGEBRA_TOOLS_H 
   14#define ML_LINEAR_ALGEBRA_TOOLS_H 
   32  template <
class OBJ_TYPE>
 
   33  void MLSwap(OBJ_TYPE &obj1, OBJ_TYPE &obj2)
 
 
   59  template <
class BASE_TYPE>
 
   62                               const typename BASE_TYPE::ComponentType  ,
 
   63                               const char * 
const                          ZeroDetErrString,
 
   64                               const BASE_TYPE                            &Identity,
 
   69    BASE_TYPE b(Identity); 
 
   70    size_t i=0, j=0, i1=0; 
 
   73    for (j=0; j<Dim; j++){
 
   76      for (i=j+1; i<Dim; i++){
 
   86      const typename BASE_TYPE::ComponentType avjj = a[j][j];
 
   88        if (isInvertible == 
nullptr)
 
   90          std::stringstream sstream;
 
   92          sstream << 
"Returning identity, matrix was:" << std::endl;
 
   93          for (
size_t y = 0; y < Dim; ++y)
 
   95            for (
size_t x = 0; x < Dim; ++x)
 
   97              sstream << std::fixed << origMat[x][y] << 
"\t";
 
  105          *isInvertible = 
false;
 
  114      for (i=0; i<Dim; i++){
 
  116          b[i] -= a[i][j]*b[j];
 
  117          a[i] -= a[i][j]*a[j];
 
  123    if (isInvertible != 
nullptr){ *isInvertible = 
true; }
 
 
bool MLValueIs0WOM(MLint8 a)
Returns true if value is 0; otherwise, it returns false.
 
DT MLAbs(const DT val)
Defines a templated MLAbs version to circumvent fabs ambiguities on different platforms.
 
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm,...
 
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)
 
void MLSwap(OBJ_TYPE &obj1, OBJ_TYPE &obj2)
Swaps two objects obj1 and obj2.
 
BASE_TYPE MLInverseMatHelper(const BASE_TYPE &origMat, bool *isInvertible, const typename BASE_TYPE::ComponentType, const char *const ZeroDetErrString, const BASE_TYPE &Identity, const size_t Dim)
Computes an N dimensional inverse from given default parameters.