MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::kernels Namespace Reference

Classes

struct  Instances
 Instances. More...
 
struct  Instances< K, 1 >
 
class  InvariantsEvaluator2D
 
class  InvariantsEvaluator3D
 
class  KernelMap
 KernelMap class which creates an unordered_map of the Keys/Kernels. More...
 

Functions

template<int dim>
MFEM_HOST_DEVICE real_t DistanceSquared (const real_t *x, const real_t *y)
 Compute the square of the Euclidean distance to another vector.
 
template<int dim>
MFEM_HOST_DEVICE void Diag (const real_t c, real_t *data)
 Creates n x n diagonal matrix with diagonal elements c.
 
template<int dim>
MFEM_HOST_DEVICE void Subtract (const real_t a, const real_t *x, const real_t *y, real_t *z)
 Vector subtraction operation: z = a * (x - y)
 
template<int dim>
MFEM_HOST_DEVICE void AddMultVWt (const real_t *v, const real_t *w, real_t *VWt)
 Dense matrix operation: VWt += v w^t.
 
template<int H, int W, typename T >
MFEM_HOST_DEVICE void FNorm (real_t &scale_factor, real_t &scaled_fnorm2, const T *data)
 
template<int H, int W, typename T >
MFEM_HOST_DEVICE real_t FNorm (const T *data)
 Compute the Frobenius norm of the matrix.
 
template<int H, int W, typename T >
MFEM_HOST_DEVICE real_t FNorm2 (const T *data)
 Compute the square of the Frobenius norm of the matrix.
 
template<typename T >
MFEM_HOST_DEVICE real_t Norml2 (const int size, const T *data)
 Returns the l2 norm of the Vector with given size and data.
 
template<typename TA , typename TX , typename TY >
MFEM_HOST_DEVICE void Mult (const int height, const int width, const TA *data, const TX *x, TY *y)
 Matrix vector multiplication: y = A x, where the matrix A is of size height x width with given data, while x and y specify the data of the input and output vectors.
 
template<typename TA , typename TX , typename TY >
MFEM_HOST_DEVICE void MultTranspose (const int height, const int width, const TA *data, const TX *x, TY *y)
 Matrix transpose vector multiplication: y = At x, where the matrix A is of size height x width with given data, while x and y specify the data of the input and output vectors.
 
template<typename T >
MFEM_HOST_DEVICE void Symmetrize (const int size, T *data)
 Symmetrize a square matrix with given size and data: A -> (A+A^T)/2.
 
template<int dim, typename T >
MFEM_HOST_DEVICE T Det (const T *data)
 Compute the determinant of a square matrix of size dim with given data.
 
template<int dim, typename T >
MFEM_HOST_DEVICE void CalcInverse (const T *data, T *inv_data)
 Return the inverse of a matrix with given size and data into the matrix with data inv_data.
 
template<int dim, typename T >
MFEM_HOST_DEVICE void CalcAdjugate (const T *data, T *adj_data)
 Return the adjugate of a matrix.
 
template<typename TALPHA , typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void Add (const int height, const int width, const TALPHA alpha, const TA *Adata, const TB *Bdata, TC *Cdata)
 Compute C = A + alpha*B, where the matrices A, B and C are of size height x width with data Adata, Bdata and Cdata.
 
template<typename TALPHA , typename TBETA , typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void Add (const int height, const int width, const TALPHA alpha, const TA *Adata, const TBETA beta, const TB *Bdata, TC *Cdata)
 Compute C = alpha*A + beta*B, where the matrices A, B and C are of size height x width with data Adata, Bdata and Cdata.
 
template<typename TA , typename TB >
MFEM_HOST_DEVICE void Add (const int height, const int width, const TA *Adata, TB *Bdata)
 Compute B += A, where the matrices A and B are of size height x width with data Adata and Bdata.
 
template<typename TA , typename TB >
MFEM_HOST_DEVICE void Add (const int height, const int width, const real_t alpha, const TA *Adata, TB *Bdata)
 Compute B +=alpha*A, where the matrices A and B are of size height x width with data Adata and Bdata.
 
template<typename TA , typename TB >
MFEM_HOST_DEVICE void Set (const int height, const int width, const real_t alpha, const TA *Adata, TB *Bdata)
 Compute B = alpha*A, where the matrices A and B are of size height x width with data Adata and Bdata.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void AddMult (const int Aheight, const int Awidth, const int Bwidth, const TB *Bdata, const TC *Cdata, TA *Adata, const TB alpha, const TA beta)
 Matrix-matrix multiplication: A = alpha * B * C + beta * A, where the matrices A, B and C are of sizes Aheight x Awidth, Aheight x Bwidth and Bwidth x Awidth, respectively.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void Mult (const int Aheight, const int Awidth, const int Bwidth, const TB *Bdata, const TC *Cdata, TA *Adata)
 Matrix-matrix multiplication: A = B * C, where the matrices A, B and C are of sizes Aheight x Awidth, Aheight x Bwidth and Bwidth x Awidth, respectively.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void MultABt (const int Aheight, const int Awidth, const int Bheight, const TA *Adata, const TB *Bdata, TC *ABtdata)
 Multiply a matrix of size Aheight x Awidth and data Adata with the transpose of a matrix of size Bheight x Awidth and data Bdata: A * Bt. Return the result in a matrix with data ABtdata.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void AddMultAtB (const int Aheight, const int Awidth, const int Bwidth, const TA *Adata, const TB *Bdata, TC *Cdata, const TB alpha, const TA beta)
 Compute C = alpha*At*B + beta*C.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void MultAtB (const int Aheight, const int Awidth, const int Bwidth, const TA *Adata, const TB *Bdata, TC *AtBdata)
 Multiply the transpose of a matrix of size Aheight x Awidth and data Adata with a matrix of size Aheight x Bwidth and data Bdata: At * B. Return the result in a matrix with data AtBdata.
 
template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void AddMultAtB (const int Aheight, const int Awidth, const int Bwidth, const TA *Adata, const TB *Bdata, TC *AtBdata)
 Multiply the transpose of a matrix of size Aheight x Awidth and data Adata with a matrix of size Aheight x Bwidth and data Bdata: At * B. Add the result to the matrix with data AtBdata.
 
template<int HEIGHT, int WIDTH>
MFEM_HOST_DEVICE void CalcLeftInverse (const real_t *data, real_t *left_inv)
 Given a matrix of size 2x1, 3x1, or 3x2, compute the left inverse.
 
template<int dim>
MFEM_HOST_DEVICE void CalcEigenvalues (const real_t *data, real_t *lambda, real_t *vec)
 
template<int dim>
MFEM_HOST_DEVICE real_t CalcSingularvalue (const real_t *data, const int i)
 Return the i'th singular value of the matrix of size dim with given data.
 
template<>
MFEM_HOST_DEVICE void CalcLeftInverse< 2, 1 > (const real_t *d, real_t *left_inv)
 
template<>
MFEM_HOST_DEVICE void CalcLeftInverse< 3, 1 > (const real_t *d, real_t *left_inv)
 
template<>
MFEM_HOST_DEVICE void CalcLeftInverse< 3, 2 > (const real_t *d, real_t *left_inv)
 
template<>
MFEM_HOST_DEVICE void CalcEigenvalues< 2 > (const real_t *data, real_t *lambda, real_t *vec)
 
template<>
MFEM_HOST_DEVICE void CalcEigenvalues< 3 > (const real_t *data, real_t *lambda, real_t *vec)
 
template<>
MFEM_HOST_DEVICE real_t CalcSingularvalue< 2 > (const real_t *data, const int i)
 Return the i'th singular value of the matrix of size 2 with given data.
 
template<>
MFEM_HOST_DEVICE real_t CalcSingularvalue< 3 > (const real_t *data, const int i)
 Return the i'th singular value of the matrix of size 3 with given data.
 
MFEM_HOST_DEVICE void LSolve (const real_t *data, const int m, const int *ipiv, real_t *x)
 Assuming L.U = P.A factored matrix of size (m x m), compute X <- L^{-1} P X, for a vector X of length m.
 
MFEM_HOST_DEVICE void USolve (const real_t *data, const int m, real_t *x)
 Assuming L.U = P.A factored matrix of size (m x m), compute X <- U^{-1} X, for a vector X of length m.
 
MFEM_HOST_DEVICE void LUSolve (const real_t *data, const int m, const int *ipiv, real_t *x)
 Assuming L.U = P.A for a factored matrix (m x m),.
 
MFEM_HOST_DEVICE void SubMult (const int m, const int n, const int r, const real_t *A21, const real_t *X1, real_t *X2)
 Given an (n x m) matrix A21, compute X2 <- X2 - A21 X1, for matrices X1, and X2 of size (m x r) and (n x r), respectively.
 
MFEM_HOST_DEVICE void BlockFactor (const real_t *data, int m, const int *ipiv, int n, real_t *A12, real_t *A21, real_t *A22)
 
MFEM_HOST_DEVICE bool LUFactor (real_t *A, const int m, int *ipiv, const real_t tol=0.0)
 Compute the LU factorization of the m x m matrix A.
 

Function Documentation

◆ Add() [1/4]

template<typename TA , typename TB >
MFEM_HOST_DEVICE void mfem::kernels::Add ( const int height,
const int width,
const real_t alpha,
const TA * Adata,
TB * Bdata )
inline

Compute B +=alpha*A, where the matrices A and B are of size height x width with data Adata and Bdata.

Definition at line 312 of file kernels.hpp.

◆ Add() [2/4]

template<typename TA , typename TB >
MFEM_HOST_DEVICE void mfem::kernels::Add ( const int height,
const int width,
const TA * Adata,
TB * Bdata )
inline

Compute B += A, where the matrices A and B are of size height x width with data Adata and Bdata.

Definition at line 299 of file kernels.hpp.

◆ Add() [3/4]

template<typename TALPHA , typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::Add ( const int height,
const int width,
const TALPHA alpha,
const TA * Adata,
const TB * Bdata,
TC * Cdata )
inline

Compute C = A + alpha*B, where the matrices A, B and C are of size height x width with data Adata, Bdata and Cdata.

Definition at line 266 of file kernels.hpp.

◆ Add() [4/4]

template<typename TALPHA , typename TBETA , typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::Add ( const int height,
const int width,
const TALPHA alpha,
const TA * Adata,
const TBETA beta,
const TB * Bdata,
TC * Cdata )
inline

Compute C = alpha*A + beta*B, where the matrices A, B and C are of size height x width with data Adata, Bdata and Cdata.

Definition at line 283 of file kernels.hpp.

◆ AddMult()

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::AddMult ( const int Aheight,
const int Awidth,
const int Bwidth,
const TB * Bdata,
const TC * Cdata,
TA * Adata,
const TB alpha,
const TA beta )
inline

Matrix-matrix multiplication: A = alpha * B * C + beta * A, where the matrices A, B and C are of sizes Aheight x Awidth, Aheight x Bwidth and Bwidth x Awidth, respectively.

Definition at line 341 of file kernels.hpp.

◆ AddMultAtB() [1/2]

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::AddMultAtB ( const int Aheight,
const int Awidth,
const int Bwidth,
const TA * Adata,
const TB * Bdata,
TC * AtBdata )
inline

Multiply the transpose of a matrix of size Aheight x Awidth and data Adata with a matrix of size Aheight x Bwidth and data Bdata: At * B. Add the result to the matrix with data AtBdata.

Definition at line 458 of file kernels.hpp.

◆ AddMultAtB() [2/2]

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::AddMultAtB ( const int Aheight,
const int Awidth,
const int Bwidth,
const TA * Adata,
const TB * Bdata,
TC * Cdata,
const TB alpha,
const TA beta )
inline

Compute C = alpha*At*B + beta*C.

Multiply the transpose of a matrix of size Aheight x Awidth and data Adata with a matrix of size Aheight x Bwidth and data Bdata.

Definition at line 411 of file kernels.hpp.

◆ AddMultVWt()

template<int dim>
MFEM_HOST_DEVICE void mfem::kernels::AddMultVWt ( const real_t * v,
const real_t * w,
real_t * VWt )
inline

Dense matrix operation: VWt += v w^t.

Definition at line 67 of file kernels.hpp.

◆ BlockFactor()

MFEM_HOST_DEVICE void mfem::kernels::BlockFactor ( const real_t * data,
int m,
const int * ipiv,
int n,
real_t * A12,
real_t * A21,
real_t * A22 )
inline

Assuming P.A = L.U factored data of size (m x m), compute the 2x2 block decomposition: | P 0 | | A A12 | = | L 0 | | U U12 | | 0 I | | A21 A22 | | L21 I | | 0 S22 | where A12, A21, and A22 are matrices of size (m x n), (n x m), and (n x n), respectively. The blocks are overwritten as follows: A12 <- U12 = L^{-1} P A12 A21 <- L21 = A21 U^{-1} A22 <- S22 = A22 - L21 U12. The block S22 is the Schur complement.

Definition at line 1783 of file kernels.hpp.

◆ CalcAdjugate()

template<int dim, typename T >
MFEM_HOST_DEVICE void mfem::kernels::CalcAdjugate ( const T * data,
T * adj_data )
inline

Return the adjugate of a matrix.

Definition at line 256 of file kernels.hpp.

◆ CalcEigenvalues()

template<int dim>
MFEM_HOST_DEVICE void mfem::kernels::CalcEigenvalues ( const real_t * data,
real_t * lambda,
real_t * vec )

Compute the spectrum of the matrix of size dim with given data, returning the eigenvalues in the array lambda and the eigenvectors in the array vec (listed consecutively).

◆ CalcEigenvalues< 2 >()

template<>
MFEM_HOST_DEVICE void mfem::kernels::CalcEigenvalues< 2 > ( const real_t * data,
real_t * lambda,
real_t * vec )
inline

Compute the spectrum of the matrix of size 2 with given data, returning the eigenvalues in the array lambda and the eigenvectors in the array vec (listed consecutively).

Definition at line 1179 of file kernels.hpp.

◆ CalcEigenvalues< 3 >()

template<>
MFEM_HOST_DEVICE void mfem::kernels::CalcEigenvalues< 3 > ( const real_t * data,
real_t * lambda,
real_t * vec )
inline

Compute the spectrum of the matrix of size 3 with given data, returning the eigenvalues in the array lambda and the eigenvectors in the array vec (listed consecutively).

Definition at line 1210 of file kernels.hpp.

◆ CalcInverse()

template<int dim, typename T >
MFEM_HOST_DEVICE void mfem::kernels::CalcInverse ( const T * data,
T * inv_data )
inline

Return the inverse of a matrix with given size and data into the matrix with data inv_data.

Definition at line 246 of file kernels.hpp.

◆ CalcLeftInverse()

template<int HEIGHT, int WIDTH>
MFEM_HOST_DEVICE void mfem::kernels::CalcLeftInverse ( const real_t * data,
real_t * left_inv )

Given a matrix of size 2x1, 3x1, or 3x2, compute the left inverse.

◆ CalcLeftInverse< 2, 1 >()

template<>
MFEM_HOST_DEVICE void mfem::kernels::CalcLeftInverse< 2, 1 > ( const real_t * d,
real_t * left_inv )
inline

Definition at line 1140 of file kernels.hpp.

◆ CalcLeftInverse< 3, 1 >()

template<>
MFEM_HOST_DEVICE void mfem::kernels::CalcLeftInverse< 3, 1 > ( const real_t * d,
real_t * left_inv )
inline

Definition at line 1148 of file kernels.hpp.

◆ CalcLeftInverse< 3, 2 >()

template<>
MFEM_HOST_DEVICE void mfem::kernels::CalcLeftInverse< 3, 2 > ( const real_t * d,
real_t * left_inv )
inline

Definition at line 1157 of file kernels.hpp.

◆ CalcSingularvalue()

template<int dim>
MFEM_HOST_DEVICE real_t mfem::kernels::CalcSingularvalue ( const real_t * data,
const int i )

Return the i'th singular value of the matrix of size dim with given data.

◆ CalcSingularvalue< 2 >()

template<>
MFEM_HOST_DEVICE real_t mfem::kernels::CalcSingularvalue< 2 > ( const real_t * data,
const int i )
inline

Return the i'th singular value of the matrix of size 2 with given data.

Definition at line 1412 of file kernels.hpp.

◆ CalcSingularvalue< 3 >()

template<>
MFEM_HOST_DEVICE real_t mfem::kernels::CalcSingularvalue< 3 > ( const real_t * data,
const int i )
inline

Return the i'th singular value of the matrix of size 3 with given data.

Definition at line 1460 of file kernels.hpp.

◆ Det()

template<int dim, typename T >
MFEM_HOST_DEVICE T mfem::kernels::Det ( const T * data)
inline

Compute the determinant of a square matrix of size dim with given data.

Definition at line 237 of file kernels.hpp.

◆ Diag()

template<int dim>
MFEM_HOST_DEVICE void mfem::kernels::Diag ( const real_t c,
real_t * data )
inline

Creates n x n diagonal matrix with diagonal elements c.

Definition at line 49 of file kernels.hpp.

◆ DistanceSquared()

template<int dim>
MFEM_HOST_DEVICE real_t mfem::kernels::DistanceSquared ( const real_t * x,
const real_t * y )
inline

Compute the square of the Euclidean distance to another vector.

Definition at line 40 of file kernels.hpp.

◆ FNorm() [1/2]

template<int H, int W, typename T >
MFEM_HOST_DEVICE real_t mfem::kernels::FNorm ( const T * data)
inline

Compute the Frobenius norm of the matrix.

Definition at line 113 of file kernels.hpp.

◆ FNorm() [2/2]

template<int H, int W, typename T >
MFEM_HOST_DEVICE void mfem::kernels::FNorm ( real_t & scale_factor,
real_t & scaled_fnorm2,
const T * data )
inline

Definition at line 79 of file kernels.hpp.

◆ FNorm2()

template<int H, int W, typename T >
MFEM_HOST_DEVICE real_t mfem::kernels::FNorm2 ( const T * data)
inline

Compute the square of the Frobenius norm of the matrix.

Definition at line 123 of file kernels.hpp.

◆ LSolve()

MFEM_HOST_DEVICE void mfem::kernels::LSolve ( const real_t * data,
const int m,
const int * ipiv,
real_t * x )
inline

Assuming L.U = P.A factored matrix of size (m x m), compute X <- L^{-1} P X, for a vector X of length m.

Definition at line 1700 of file kernels.hpp.

◆ LUFactor()

MFEM_HOST_DEVICE bool mfem::kernels::LUFactor ( real_t * A,
const int m,
int * ipiv,
const real_t tol = 0.0 )
inline

Compute the LU factorization of the m x m matrix A.

Factorize the matrix of size (m x m) overwriting it with the LU factors. The factorization is such that L.U = P.A, where A is the original matrix and P is a permutation matrix represented by ipiv.

Parameters
[in,out]Amatrix
[in]msize of the square matrix
[out]ipivarray of pivots (length m)
[in]toloptional fuzzy comparison tolerance. Defaults to 0.0.
Returns
true if the factorization succeeds, false otherwise (zero pivot).

Definition at line 1825 of file kernels.hpp.

◆ LUSolve()

MFEM_HOST_DEVICE void mfem::kernels::LUSolve ( const real_t * data,
const int m,
const int * ipiv,
real_t * x )
inline

Assuming L.U = P.A for a factored matrix (m x m),.

Definition at line 1745 of file kernels.hpp.

◆ Mult() [1/2]

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::Mult ( const int Aheight,
const int Awidth,
const int Bwidth,
const TB * Bdata,
const TC * Cdata,
TA * Adata )
inline

Matrix-matrix multiplication: A = B * C, where the matrices A, B and C are of sizes Aheight x Awidth, Aheight x Bwidth and Bwidth x Awidth, respectively.

Definition at line 372 of file kernels.hpp.

◆ Mult() [2/2]

template<typename TA , typename TX , typename TY >
MFEM_HOST_DEVICE void mfem::kernels::Mult ( const int height,
const int width,
const TA * data,
const TX * x,
TY * y )
inline

Matrix vector multiplication: y = A x, where the matrix A is of size height x width with given data, while x and y specify the data of the input and output vectors.

Definition at line 163 of file kernels.hpp.

◆ MultABt()

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::MultABt ( const int Aheight,
const int Awidth,
const int Bheight,
const TA * Adata,
const TB * Bdata,
TC * ABtdata )
inline

Multiply a matrix of size Aheight x Awidth and data Adata with the transpose of a matrix of size Bheight x Awidth and data Bdata: A * Bt. Return the result in a matrix with data ABtdata.

Definition at line 383 of file kernels.hpp.

◆ MultAtB()

template<typename TA , typename TB , typename TC >
MFEM_HOST_DEVICE void mfem::kernels::MultAtB ( const int Aheight,
const int Awidth,
const int Bwidth,
const TA * Adata,
const TB * Bdata,
TC * AtBdata )
inline

Multiply the transpose of a matrix of size Aheight x Awidth and data Adata with a matrix of size Aheight x Bwidth and data Bdata: At * B. Return the result in a matrix with data AtBdata.

Definition at line 447 of file kernels.hpp.

◆ MultTranspose()

template<typename TA , typename TX , typename TY >
MFEM_HOST_DEVICE void mfem::kernels::MultTranspose ( const int height,
const int width,
const TA * data,
const TX * x,
TY * y )
inline

Matrix transpose vector multiplication: y = At x, where the matrix A is of size height x width with given data, while x and y specify the data of the input and output vectors.

Definition at line 196 of file kernels.hpp.

◆ Norml2()

template<typename T >
MFEM_HOST_DEVICE real_t mfem::kernels::Norml2 ( const int size,
const T * data )
inline

Returns the l2 norm of the Vector with given size and data.

Definition at line 133 of file kernels.hpp.

◆ Set()

template<typename TA , typename TB >
MFEM_HOST_DEVICE void mfem::kernels::Set ( const int height,
const int width,
const real_t alpha,
const TA * Adata,
TB * Bdata )
inline

Compute B = alpha*A, where the matrices A and B are of size height x width with data Adata and Bdata.

Definition at line 326 of file kernels.hpp.

◆ SubMult()

MFEM_HOST_DEVICE void mfem::kernels::SubMult ( const int m,
const int n,
const int r,
const real_t * A21,
const real_t * X1,
real_t * X2 )
inline

Given an (n x m) matrix A21, compute X2 <- X2 - A21 X1, for matrices X1, and X2 of size (m x r) and (n x r), respectively.

Definition at line 1755 of file kernels.hpp.

◆ Subtract()

template<int dim>
MFEM_HOST_DEVICE void mfem::kernels::Subtract ( const real_t a,
const real_t * x,
const real_t * y,
real_t * z )
inline

Vector subtraction operation: z = a * (x - y)

Definition at line 58 of file kernels.hpp.

◆ Symmetrize()

template<typename T >
MFEM_HOST_DEVICE void mfem::kernels::Symmetrize ( const int size,
T * data )
inline

Symmetrize a square matrix with given size and data: A -> (A+A^T)/2.

Definition at line 223 of file kernels.hpp.

◆ USolve()

MFEM_HOST_DEVICE void mfem::kernels::USolve ( const real_t * data,
const int m,
real_t * x )
inline

Assuming L.U = P.A factored matrix of size (m x m), compute X <- U^{-1} X, for a vector X of length m.

Definition at line 1725 of file kernels.hpp.