|
Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
\( v^i = T^{ij} w_j\) More...
Namespaces | |
| namespace | dg::tensor |
| Utility functions used in connection with the SparseTensor class. | |
Classes | |
| struct | dg::SparseTensor< container > |
| Class for 2x2 and 3x3 matrices sharing elements. More... | |
Functions | |
| template<class ContainerType0 , class ContainerType1 > | |
| void | dg::tensor::scal (SparseTensor< ContainerType0 > &t, const ContainerType1 &mu) |
| \( t^{ij} = \mu t^{ij} \ \forall i,j \) | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerTypeM , class ContainerType3 , class ContainerType4 > | |
| void | dg::tensor::multiply2d (const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1) |
| \( w^i = \sum_{i=0}^1 \lambda t^{ij}v_j + \mu w^i \text{ for } i\in \{0,1\}\) | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerTypeM , class ContainerType4 , class ContainerType5 , class ContainerType6 > | |
| void | dg::tensor::multiply3d (const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2) |
| \( w^i = \sum_{i=0}^2\lambda t^{ij}v_j + \mu w^i \text{ for } i\in \{0,1,2\}\) | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerTypeM , class ContainerType3 , class ContainerType4 > | |
| void | dg::tensor::inv_multiply2d (const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1) |
| \( v_j = \sum_{i=0}^1\lambda (t^{-1})_{ji}w^i + \mu v_j \text{ for } i\in \{0,1\}\) | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerTypeM , class ContainerType4 , class ContainerType5 , class ContainerType6 > | |
| void | dg::tensor::inv_multiply3d (const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2) |
| \( v_j = \sum_{i=0}^2\lambda(t^{-1})_{ji}w^i + \mu v_j \text{ for } i\in \{0,1,2\}\)i | |
| template<class ContainerType > | |
| ContainerType | dg::tensor::determinant2d (const SparseTensor< ContainerType > &t) |
| \(\det_{2d}( t)\) | |
| template<class ContainerType > | |
| ContainerType | dg::tensor::determinant (const SparseTensor< ContainerType > &t) |
| \(\det( t)\) | |
| template<class ContainerType > | |
| ContainerType | dg::tensor::volume2d (const SparseTensor< ContainerType > &t) |
| \( \sqrt{\det_{2d}(t)}^{-1}\) | |
| template<class ContainerType > | |
| ContainerType | dg::tensor::volume (const SparseTensor< ContainerType > &t) |
| \( \sqrt{\det(t)}^{-1}\) | |
| template<class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerType4 > | |
| void | dg::tensor::multiply2d (const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, ContainerType3 &out0, ContainerType4 &out1) |
| \( w^i = \sum_{i=0}^1 t^{ij}v_j \text{ for } i\in \{0,1\}\) | |
| template<class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerType4 , class ContainerType5 , class ContainerType6 > | |
| void | dg::tensor::multiply3d (const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2) |
| \( w^i = \sum_{i=0}^2 t^{ij}v_j \text{ for } i\in \{0,1,2\}\) | |
| template<class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerType4 > | |
| void | dg::tensor::inv_multiply2d (const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, ContainerType3 &out0, ContainerType4 &out1) |
| \( v_j = \sum_{i=0}^1(t^{-1})_{ji}w^i \text{ for } i\in \{0,1\}\) | |
| template<class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerType4 , class ContainerType5 , class ContainerType6 > | |
| void | dg::tensor::inv_multiply3d (const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2) |
| \( v_j = \sum_{i=0}^2(t^{-1})_{ji}w^i \text{ for } i\in \{0,1,2\}\)i | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerTypeM , class ContainerType4 , class ContainerType5 , class value_type0 , class value_type1 > | |
| void | dg::tensor::scalar_product2d (value_type0 alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const SparseTensor< ContainerType2 > &t, const ContainerTypeM &mu, const ContainerType3 &w0, const ContainerType4 &w1, value_type1 beta, ContainerType5 &y) |
| \( y = \alpha \lambda\mu \sum_{i=0}^1 v_it^{ij}w_j + \beta y \text{ for } i\in \{0,1\}\) | |
| template<class ContainerTypeL , class ContainerType0 , class ContainerType1 , class ContainerType2 , class ContainerType3 , class ContainerTypeM , class ContainerType4 , class ContainerType5 , class ContainerType6 , class ContainerType7 , class value_type0 , class value_type1 > | |
| void | dg::tensor::scalar_product3d (value_type0 alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const ContainerType2 &v2, const SparseTensor< ContainerType3 > &t, const ContainerTypeM &mu, const ContainerType4 &w0, const ContainerType5 &w1, const ContainerType6 &w2, value_type1 beta, ContainerType7 &y) |
| \( y = \alpha \lambda\mu \sum_{i=0}^2 v_it^{ij}w_j + \beta y \text{ for } i\in \{0,1,2\}\) | |
\( v^i = T^{ij} w_j\)
| ContainerType dg::tensor::determinant | ( | const SparseTensor< ContainerType > & | t | ) |
\(\det( t)\)
Compute the determinant of a 3d tensor: \( \det(t) := t_{00}t_{11}t_{22} + t_{01}t_{12}t_{20} + \ldots - t_{22}t_{10}t_{01}\).
| t | the input tensor |
dg::blas1::evaluate | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| ContainerType dg::tensor::determinant2d | ( | const SparseTensor< ContainerType > & | t | ) |
\(\det_{2d}( t)\)
Compute the minor determinant of a tensor \( \det_{2d}(t) := t_{00}t_{01}-t_{10}t_{11}\).
| t | the input tensor |
t dg::blas1::evaluate | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::inv_multiply2d | ( | const ContainerTypeL & | lambda, |
| const SparseTensor< ContainerType0 > & | t, | ||
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerTypeM & | mu, | ||
| ContainerType3 & | out0, | ||
| ContainerType4 & | out1 ) |
\( v_j = \sum_{i=0}^1\lambda (t^{-1})_{ji}w^i + \mu v_j \text{ for } i\in \{0,1\}\)
Multiply the inverse of a tensor t with a vector in 2d. Ignore the 3rd dimension in t. The inverse of t is computed inplace.
| t | input Tensor |
| lambda | (input) (may be a vector or an actual number like 0 or 1) |
| in0 | (input) first component of w (may alias out0) |
| in1 | (input) second component of w (may alias out1) |
| mu | (input) (may be a vector or an actual number like 0 or 1) |
| out0 | (output) first component of v (may alias in0) |
| out1 | (output) second component of v (may alias in1) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::inv_multiply2d | ( | const SparseTensor< ContainerType0 > & | t, |
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| ContainerType3 & | out0, | ||
| ContainerType4 & | out1 ) |
\( v_j = \sum_{i=0}^1(t^{-1})_{ji}w^i \text{ for } i\in \{0,1\}\)
Multiply the inverse of a tensor t with a vector in 2d. Ignore the 3rd dimension in t. The inverse of t is computed inplace.
| t | input Tensor |
| in0 | (input) first component of w (may alias out0) |
| in1 | (input) second component of w (may alias out1) |
| out0 | (output) first component of v (may alias in0) |
| out1 | (output) second component of v (may alias in1) |
| ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::inv_multiply3d | ( | const ContainerTypeL & | lambda, |
| const SparseTensor< ContainerType0 > & | t, | ||
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerType3 & | in2, | ||
| const ContainerTypeM & | mu, | ||
| ContainerType4 & | out0, | ||
| ContainerType5 & | out1, | ||
| ContainerType6 & | out2 ) |
\( v_j = \sum_{i=0}^2\lambda(t^{-1})_{ji}w^i + \mu v_j \text{ for } i\in \{0,1,2\}\)i
Multiply the inverse of a tensor with a vector in 3d. The inverse of t is computed inplace.
| t | input Tensor |
| lambda | (input) (may be a vector or an actual number like 0 or 1) |
| in0 | (input) first component of w (may alias out0) |
| in1 | (input) second component of w (may alias out1) |
| in2 | (input) third component of w (may alias out2) |
| mu | (input) (may be a vector or an actual number like 0 or 1) |
| out0 | (output) first component of v (may alias in0) |
| out1 | (output) second component of v (may alias in1) |
| out2 | (output) third component of v (may alias in2) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::inv_multiply3d | ( | const SparseTensor< ContainerType0 > & | t, |
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerType3 & | in2, | ||
| ContainerType4 & | out0, | ||
| ContainerType5 & | out1, | ||
| ContainerType6 & | out2 ) |
\( v_j = \sum_{i=0}^2(t^{-1})_{ji}w^i \text{ for } i\in \{0,1,2\}\)i
Multiply the inverse of a tensor with a vector in 3d. The inverse of t is computed inplace.
| t | input Tensor |
| in0 | (input) first component of w (may alias out0) |
| in1 | (input) second component of w (may alias out1) |
| in2 | (input) third component of w (may alias out2) |
| out0 | (output) first component of v (may alias in0) |
| out1 | (output) second component of v (may alias in1) |
| out2 | (output) third component of v (may alias in2) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::multiply2d | ( | const ContainerTypeL & | lambda, |
| const SparseTensor< ContainerType0 > & | t, | ||
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerTypeM & | mu, | ||
| ContainerType3 & | out0, | ||
| ContainerType4 & | out1 ) |
\( w^i = \sum_{i=0}^1 \lambda t^{ij}v_j + \mu w^i \text{ for } i\in \{0,1\}\)
Multiply a tensor with a vector in 2d. Ignore the 3rd dimension in t.
| t | input Tensor |
| lambda | (input) |
| in0 | (input) first component of v (may alias out0) |
| in1 | (input) second component of v (may alias out1) |
| mu | (input) |
| out0 | (output) first component of w (may alias in0) |
| out1 | (output) second component of w (may alias in1) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::multiply2d | ( | const SparseTensor< ContainerType0 > & | t, |
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| ContainerType3 & | out0, | ||
| ContainerType4 & | out1 ) |
\( w^i = \sum_{i=0}^1 t^{ij}v_j \text{ for } i\in \{0,1\}\)
Multiply a tensor with a vector in 2d. Ignore the 3rd dimension in t.
| t | input Tensor |
| in0 | (input) first component of v (may alias out0) |
| in1 | (input) second component of v (may alias out1) |
| out0 | (output) first component of w (may alias in0) |
| out1 | (output) second component of w (may alias in1) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::multiply3d | ( | const ContainerTypeL & | lambda, |
| const SparseTensor< ContainerType0 > & | t, | ||
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerType3 & | in2, | ||
| const ContainerTypeM & | mu, | ||
| ContainerType4 & | out0, | ||
| ContainerType5 & | out1, | ||
| ContainerType6 & | out2 ) |
\( w^i = \sum_{i=0}^2\lambda t^{ij}v_j + \mu w^i \text{ for } i\in \{0,1,2\}\)
Multiply a tensor with a vector in 3d.
| t | input Tensor |
| lambda | (input) (may be a vector or an actual number like 0 or 1) |
| in0 | (input) first component of v (may alias out0) |
| in1 | (input) second component of v (may alias out1) |
| in2 | (input) third component of v (may alias out2) |
| mu | (input) (may be a vector or an actual number like 0 or 1) |
| out0 | (output) first component of w (may alias in0) |
| out1 | (output) second component of w (may alias in1) |
| out2 | (output) third component of w (may alias in2) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::multiply3d | ( | const SparseTensor< ContainerType0 > & | t, |
| const ContainerType1 & | in0, | ||
| const ContainerType2 & | in1, | ||
| const ContainerType3 & | in2, | ||
| ContainerType4 & | out0, | ||
| ContainerType5 & | out1, | ||
| ContainerType6 & | out2 ) |
\( w^i = \sum_{i=0}^2 t^{ij}v_j \text{ for } i\in \{0,1,2\}\)
Multiply a tensor with a vector in 3d.
| t | input Tensor |
| in0 | (input) first component of v (may alias out0) |
| in1 | (input) second component of v (may alias out1) |
| in2 | (input) third component of v (may alias out2) |
| out0 | (output) first component of w (may alias in0) |
| out1 | (output) second component of w (may alias in1) |
| out2 | (output) third component of w (may alias in2) |
dg::blas1::subroutine | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::scal | ( | SparseTensor< ContainerType0 > & | t, |
| const ContainerType1 & | mu ) |
\( t^{ij} = \mu t^{ij} \ \forall i,j \)
Scale tensor with a Scalar or a Vector
| t | input (contains result on output) |
| mu | all elements in t are scaled with mu |
| ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::scalar_product2d | ( | value_type0 | alpha, |
| const ContainerTypeL & | lambda, | ||
| const ContainerType0 & | v0, | ||
| const ContainerType1 & | v1, | ||
| const SparseTensor< ContainerType2 > & | t, | ||
| const ContainerTypeM & | mu, | ||
| const ContainerType3 & | w0, | ||
| const ContainerType4 & | w1, | ||
| value_type1 | beta, | ||
| ContainerType5 & | y ) |
\( y = \alpha \lambda\mu \sum_{i=0}^1 v_it^{ij}w_j + \beta y \text{ for } i\in \{0,1\}\)
Ignore the 3rd dimension in t.
| alpha | scalar input prefactor |
| lambda | second input prefactor |
| v0 | (input) first component of v (may alias w0) |
| v1 | (input) second component of v (may alias w1) |
| t | input Tensor |
| mu | third input prefactor |
| w0 | (input) first component of w (may alias v0) |
| w1 | (input) second component of w (may alias v1) |
| beta | scalar output prefactor |
| y | (output) |
dg::blas1::evaluate | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| void dg::tensor::scalar_product3d | ( | value_type0 | alpha, |
| const ContainerTypeL & | lambda, | ||
| const ContainerType0 & | v0, | ||
| const ContainerType1 & | v1, | ||
| const ContainerType2 & | v2, | ||
| const SparseTensor< ContainerType3 > & | t, | ||
| const ContainerTypeM & | mu, | ||
| const ContainerType4 & | w0, | ||
| const ContainerType5 & | w1, | ||
| const ContainerType6 & | w2, | ||
| value_type1 | beta, | ||
| ContainerType7 & | y ) |
\( y = \alpha \lambda\mu \sum_{i=0}^2 v_it^{ij}w_j + \beta y \text{ for } i\in \{0,1,2\}\)
| alpha | scalar input prefactor |
| lambda | second input prefactor |
| v0 | (input) first component of v (may alias w0) |
| v1 | (input) second component of v (may alias w1) |
| v2 | (input) third component of v (may alias w1) |
| t | input Tensor |
| mu | third input prefactor |
| w0 | (input) first component of w (may alias v0) |
| w1 | (input) second component of w (may alias v1) |
| w2 | (input) third component of w (may alias v1) |
| beta | scalar output prefactor |
| y | (output) |
dg::blas1::evaluate | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| ContainerType dg::tensor::volume | ( | const SparseTensor< ContainerType > & | t | ) |
\( \sqrt{\det(t)}^{-1}\)
Compute the sqrt of the inverse determinant of a 3d tensor. This is a convenience function that is equivalent to
\[ \sqrt{g} = 1 / \sqrt{ \det( g^{-1})}\]
| t | the input tensor |
t | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
| ContainerType dg::tensor::volume2d | ( | const SparseTensor< ContainerType > & | t | ) |
\( \sqrt{\det_{2d}(t)}^{-1}\)
Compute the sqrt of the inverse minor determinant of a tensor. This is a convenience function that is equivalent to
\[ \sqrt{g} = 1 / \sqrt{ \det( g^{-1})}\]
| t | the input tensor |
t | ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |