SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
crvMath.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Scientific Computation Research Center
3  *
4  * This work is open source software, licensed under the terms of the
5  * BSD license as described in the LICENSE file in the top-level directory.
6  */
7 
8 #ifndef CRVMATH_H
9 #define CRVMATH_H
10 
11 #include "crv.h"
12 #include <mthQR.h>
13 
17 namespace crv {
18 
20 int binomial(int n, int i);
22 int trinomial(int n, int i, int j);
24 int quadnomial(int n, int i, int j, int k);
25 
27 inline double intpow(const double b, const int e)
28 {
29  switch (e) {
30  case 0: return 1.0;
31  case 1: return b;
32  case 2: return b*b;
33  case 3: return b*b*b;
34  case 4: return b*b*b*b;
35  case 5: return b*b*b*b*b;
36  case 6: return b*b*b*b*b*b;
37  default:
38  return intpow(b, e-6) * intpow(b, 6);
39  }
40 }
41 
48 }
49 
50 #endif
51 
int quadnomial(int n, int i, int j, int k)
&quot;quadnomial&quot; function n!/(i!j!k!(n-i-j-k)!)
compile-time (static) matrix
Definition: mthMatrix.h:23
void invertMatrixWithPLU(int n, mth::Matrix< double > &A, mth::Matrix< double > &Ai)
invert a matrix using Pivoting and LU decomposition
int trinomial(int n, int i, int j)
trinomial function n!/(i!j!(n-i-j)!)
int binomial(int n, int i)
binomial function n!/(i!(n-i)!)
void invertMatrixWithQR(int n, mth::Matrix< double > &A, mth::Matrix< double > &Ai)
invert a matrix using QR factorization
double intpow(const double b, const int e)
faster power for integers
Definition: crvMath.h:27
routines for the QR factorization of matrices
main file for curved element support