https://mooseframework.inl.gov
Namespaces | Functions
MathUtils.C File Reference

Go to the source code of this file.

Namespaces

 MathUtils
 

Functions

void MathUtils::kron (RealEigenMatrix &product, const RealEigenMatrix &mat_A, const RealEigenMatrix &mat_B)
 Computes the Kronecker product of two matrices. More...
 
Real MathUtils::plainLog (Real x, unsigned int derivative_order)
 
Real MathUtils::poly1Log (Real x, Real tol, unsigned int derivative_order)
 
Real MathUtils::poly2Log (Real x, Real tol, unsigned int derivative_order)
 
Real MathUtils::poly3Log (Real x, Real tol, unsigned int derivative_order)
 
Real MathUtils::poly4Log (Real x, Real tol, unsigned int derivative_order)
 
Real MathUtils::taylorLog (Real x)
 
std::vector< std::vector< unsigned int > > MathUtils::multiIndex (unsigned int dim, unsigned int order)
 generate a complete multi index table for given dimension and order i.e. More...
 
Point MathUtils::barycentricToCartesian2D (const Point &p0, const Point &p1, const Point &p2, const Real b0, const Real b1, const Real b2)
 Evaluate Cartesian coordinates of any center point of a triangle given Barycentric coordinates of center point and Cartesian coordinates of triangle's vertices. More...
 
Point MathUtils::barycentricToCartesian3D (const Point &p0, const Point &p1, const Point &p2, const Point &p3, const Real b0, const Real b1, const Real b2, const Real b3)
 Evaluate Cartesian coordinates of any center point of a tetrahedron given Barycentric coordinates of center point and Cartesian coordinates of tetrahedon's vertices. More...
 
Point MathUtils::circumcenter2D (const Point &p0, const Point &p1, const Point &p2)
 Evaluate circumcenter of a triangle given three arbitrary points. More...
 
Point MathUtils::circumcenter3D (const Point &p0, const Point &p1, const Point &p2, const Point &p3)
 Evaluate circumcenter of a tetrahedrom given four arbitrary points. More...
 
std::vector< std::vector< unsigned int > > multiIndexHelper (unsigned int N, unsigned int K)
 A helper function for MathUtils::multiIndex. More...
 

Function Documentation

◆ multiIndexHelper()

std::vector<std::vector<unsigned int> > multiIndexHelper ( unsigned int  N,
unsigned int  K 
)

A helper function for MathUtils::multiIndex.

Definition at line 333 of file MathUtils.C.

Referenced by MathUtils::multiIndex().

334 {
335  std::vector<std::vector<unsigned int>> n_choose_k;
336  std::vector<unsigned int> row;
337  std::string bitmask(K, 1); // K leading 1's
338  bitmask.resize(N, 0); // N-K trailing 0's
339 
340  do
341  {
342  row.clear();
343  row.push_back(0);
344  for (unsigned int i = 0; i < N; ++i) // [0..N-1] integers
345  if (bitmask[i])
346  row.push_back(i + 1);
347  row.push_back(N + 1);
348  n_choose_k.push_back(row);
349  } while (std::prev_permutation(bitmask.begin(), bitmask.end()));
350 
351  return n_choose_k;
352 }