|
FEAT 3
Finite Element Analysis Toolbox
|
Tiny Tensor3 class template. More...
#include <tiny_algebra.hpp>
Public Types | |
| typedef Intern::DataTypeExtractor< ValueType >::MyDataType | DataType |
| The basic data type buried in the lowest level of the vector. More... | |
| typedef Matrix< T_, m_, n_, sm_, sn_ > | PlaneType |
| Type of tensor data; that's an array of matrices. More... | |
| typedef T_ | ValueType |
| the data type of the tensor More... | |
Public Member Functions | |
| CUDA_HOST_DEVICE | Tensor3 () |
| default constructor More... | |
| template<typename Tx_ > | |
| CUDA_HOST_DEVICE | Tensor3 (const std::initializer_list< std::initializer_list< std::initializer_list< Tx_ > > > &x) |
| Initializer list constructor. More... | |
| template<typename Tx_ > | |
| CUDA_HOST_DEVICE | Tensor3 (const std::initializer_list< Tx_ > &x) |
| Initializer list constructor. More... | |
| template<int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE | Tensor3 (const Tensor3< T_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| copy-constructor More... | |
| CUDA_HOST_DEVICE | Tensor3 (DataType value) |
| value-assignment constructor More... | |
| template<int lt_, int mt_, int nt_, int slt_, int smt_, int snt_, int smb_, int snb_, int smd_, int snd_> | |
| CUDA_HOST_DEVICE Tensor3 & | add_double_mat_mult (const Tensor3< T_, lt_, mt_, nt_, slt_, smt_, snt_ > &t, const Matrix< T_, nt_, n_, smb_, snb_ > &b, const Matrix< T_, mt_, m_, smd_, snd_ > &d, DataType alpha=DataType(1)) |
| Adds the result of a matrix-tensor-matrix double-product onto this tensor. More... | |
| template<int k_, int sma_, int sna_, int slt_, int smt_, int snt_> | |
| CUDA_HOST_DEVICE Tensor3 & | add_mat_tensor_mult (const Matrix< T_, l_, k_, sma_, sna_ > &a, const Tensor3< T_, k_, m_, n_, slt_, smt_, snt_ > &t, DataType alpha=DataType(1)) |
| Adds the result of a matrix-tensor product onto this tensor. More... | |
| template<int slx_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE Tensor3 & | add_vec_mat_outer_product (const Vector< T_, l_, slx_ > &x, const Matrix< T_, m_, n_, sma_, sna_ > &a, DataType alpha=DataType(1)) |
| Adds the result of a vector-matrix outer product onto this tensor. More... | |
| template<typename Tx_ , int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE void | convert (const Tensor3< Tx_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| conversion operator More... | |
| template<int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE void | copy (const Tensor3< T_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| Copies a tensor3. More... | |
| template<int ll_, int mm_, int nn_, int la_, int ma_, int na_, int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE void | copy_n (const Tensor3< T_, la_, ma_, na_, sla_, sma_, sna_ > &a) |
| Copies the upper left mm_ x nn_ entries of a matrix. More... | |
| CUDA_HOST_DEVICE void | format (DataType alpha=DataType(0)) |
| formats the tensor More... | |
| CUDA_HOST_DEVICE T_ & | operator() (int h, int i, int j) |
| Access operator. More... | |
| CUDA_HOST_DEVICE const T_ & | operator() (int h, int i, int j) const |
| Access operator. More... | |
| CUDA_HOST_DEVICE Tensor3 & | operator*= (DataType alpha) |
| scalar right-multiply-by operator More... | |
| template<int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE Tensor3 & | operator+= (const Tensor3< T_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| tensor component-wise addition operator More... | |
| template<int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE Tensor3 & | operator-= (const Tensor3< T_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| tensor component-wise subtraction operator More... | |
| template<typename Tx_ > | |
| CUDA_HOST_DEVICE Tensor3 & | operator= (const std::initializer_list< std::initializer_list< std::initializer_list< Tx_ > > > &x) |
| Initializer list assignment operator. More... | |
| template<typename Tx_ > | |
| CUDA_HOST_DEVICE Tensor3 & | operator= (const std::initializer_list< Tx_ > &x) |
| Initializer list assignment operator. More... | |
| template<int sla_, int sma_, int sna_> | |
| CUDA_HOST_DEVICE Tensor3 & | operator= (const Tensor3< T_, l_, m_, n_, sla_, sma_, sna_ > &a) |
| copy-assignment operator More... | |
| CUDA_HOST_DEVICE Tensor3 & | operator= (DataType value) |
| value-assignment operator More... | |
| CUDA_HOST_DEVICE PlaneType & | operator[] (int h) |
| Plane-Access operator. More... | |
| CUDA_HOST_DEVICE const PlaneType & | operator[] (int h) const |
| Plane-Access operator. More... | |
Static Public Member Functions | |
| static CUDA_HOST_DEVICE Tensor3 | null () |
| Returns a null-tensor. More... | |
Public Attributes | |
| PlaneType | v [sl_] |
| Actual tensor data. More... | |
Static Public Attributes | |
| static constexpr int | l = l_ |
| the tube count of the tensor More... | |
| static constexpr int | m = m_ |
| the row count of the tensor More... | |
| static constexpr int | n = n_ |
| the column count of the tensor More... | |
| static constexpr int | sl = sl_ |
| the tube stride of the tensor More... | |
| static constexpr int | sm = sm_ |
| the row stride of the tensor More... | |
| static constexpr int | sn = sn_ |
| the column stride of the tensor More... | |
This class template implements a 3rd-order tensor whose datatype and sizes are given at compile-time. This class template implements a 3rd order tensor whose value type and size is given at compile-time. The value type can be a primitive type, or some other object like a Vector.
Technically, the Tensor3 class template realizes a l-tuple of m-by-n matrices.
| T_ | The datatype that the vector shall contain. |
| l_,m_,n_ | The number tubes, rows and columns of the tensor. Must be > 0. |
| sl_,The | tube stride of the tensor. Must be >= l_. |
| sm_ | The row stride of the tensor. Must be >= m_. |
| sn_ | The column stride of the tensor. Must be >= n_. |
Definition at line 120 of file tiny_algebra.hpp.
| typedef Intern::DataTypeExtractor<ValueType>::MyDataType FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::DataType |
The basic data type buried in the lowest level of the vector.
Definition at line 2575 of file tiny_algebra.hpp.
| typedef Matrix<T_, m_, n_, sm_, sn_> FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::PlaneType |
Type of tensor data; that's an array of matrices.
Definition at line 2578 of file tiny_algebra.hpp.
| typedef T_ FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::ValueType |
the data type of the tensor
Definition at line 2573 of file tiny_algebra.hpp.
|
inline |
default constructor
Definition at line 2583 of file tiny_algebra.hpp.
Referenced by FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::null().
|
inlineexplicit |
value-assignment constructor
Definition at line 2588 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::value.
|
inlineexplicit |
Initializer list constructor.
| [in] | x | The initializer list whose elements are to be assigned. |
Definition at line 2601 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and XASSERTM.
|
inlineexplicit |
Initializer list constructor.
| [in] | x | The initializer list whose elements are to be assigned. |
Definition at line 2616 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and XASSERTM.
|
inline |
copy-constructor
Definition at line 2626 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
|
inline |
Adds the result of a matrix-tensor-matrix double-product onto this tensor.
Let K denote this l-by-m-by-n tensor, T the l-by-m'-by-n' input tensor, B the m'-by-m and D the n'-by-n input matrices, then this operation computes:
\[ \forall h\in\{0,...,l-1\}, i\in\{0,...,m-1\}, j\in\{0,...,n-1\}:~ K_{hij} \leftarrow K_{hij} + \alpha \sum_{p=0}^{m'-1}\sum_{q=0}^{n'-1} T_{hpq}\cdot B_{pi}\cdot D_{qj} \]
| [in] | t | The l-by-m'-by-n' tensor that serves as the inner multiplicand. |
| [in] | b | The m'-by-m matrix that serves as the left multiplicand. |
| [in] | d | The n'-by-n matrix that serves as the right multiplicand. |
| [in] | alpha | A scaling factor for the product. |
*this Definition at line 2890 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator()().
|
inline |
Adds the result of a matrix-tensor product onto this tensor.
Let K denote this tensor, A the input matrix and T the input tensor, then this operation computes:
\[ \forall h\in\{0,...,l-1\}, i\in\{0,...,m-1\},j\in\{0,...,n-1\}:~ K_{hij} \leftarrow K_{hij} + \alpha \sum_{p=0}^{k-1} A_{hp}\cdot T_{pij}\]
| [in] | a | The l-by-k matrix that serves as the left multiplicand. |
| [in] | t | The k-by-m-by-n tensor that serves as the right multiplicand. |
| [in] | alpha | A scaling factor for the product. |
*this Definition at line 2836 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator()().
|
inline |
Adds the result of a vector-matrix outer product onto this tensor.
Let K denote this tensor, x the input vector and A the input matrix, then this operation computes:
\[ \forall h\in\{0,...,l-1\}, i\in\{0,...,m-1\},j\in\{0,...,n-1\}:~ K_{hij} \leftarrow K_{hij} + \alpha x_h A_{ij}\]
| [in] | x | The l-length vector that serves as the left multiplicand. |
| [in] | a | The m-by-n matrix that serves as the right multiplicand. |
| [in] | alpha | A scaling factor for the product. |
*this Definition at line 2941 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator()().
|
inline |
conversion operator
Definition at line 2687 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::convert(), and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
Referenced by FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::convert().
|
inline |
Copies a tensor3.
| [in] | a | The source tensor3 to copy |
Definition at line 2774 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.
|
inline |
Copies the upper left mm_ x nn_ entries of a matrix.
| mm_ | The number of matrix rows to copy; must be mm_ <= min(m_, ma_) |
| nn_ | The number of matrix columns to copy; must be nn_ <= min(n_, na_) |
| [in] | x | The source vector to copy the elements from |
Definition at line 2795 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.
|
inline |
formats the tensor
Definition at line 2810 of file tiny_algebra.hpp.
|
inlinestatic |
Returns a null-tensor.
Definition at line 2962 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::Tensor3().
|
inline |
Access operator.
| [in] | h,i,j | The indices of the tensor entry that is to be returned. |
Definition at line 2702 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
Referenced by FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::add_double_mat_mult(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::add_mat_tensor_mult(), and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::add_vec_mat_outer_product().
|
inline |
Access operator.
| [in] | h,i,j | The indices of the tensor entry that is to be returned. |
Definition at line 2711 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
|
inline |
scalar right-multiply-by operator
Definition at line 2742 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
|
inline |
tensor component-wise addition operator
Definition at line 2751 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.
|
inline |
tensor component-wise subtraction operator
Definition at line 2760 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.
|
inline |
Initializer list assignment operator.
| [in] | x | The initializer list whose elements are to be assigned. |
Definition at line 2676 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and XASSERTM.
|
inline |
Initializer list assignment operator.
| [in] | x | The initializer list whose elements are to be assigned. |
Definition at line 2658 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and XASSERTM.
|
inline |
copy-assignment operator
Definition at line 2642 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.
|
inline |
value-assignment operator
Definition at line 2633 of file tiny_algebra.hpp.
References FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v, and FEAT::value.
|
inline |
Plane-Access operator.
| [in] | h | The index of the plane that is to be returned. |
h-th plane of the tensor. Definition at line 2728 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
|
inline |
Plane-Access operator.
| [in] | h | The index of the plane that is to be returned. |
h-th plane of the tensor. Definition at line 2735 of file tiny_algebra.hpp.
References ASSERTM, and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v.
|
staticconstexpr |
the tube count of the tensor
Definition at line 2560 of file tiny_algebra.hpp.
|
staticconstexpr |
the row count of the tensor
Definition at line 2562 of file tiny_algebra.hpp.
|
staticconstexpr |
the column count of the tensor
Definition at line 2564 of file tiny_algebra.hpp.
|
staticconstexpr |
the tube stride of the tensor
Definition at line 2566 of file tiny_algebra.hpp.
|
staticconstexpr |
the row stride of the tensor
Definition at line 2568 of file tiny_algebra.hpp.
|
staticconstexpr |
the column stride of the tensor
Definition at line 2570 of file tiny_algebra.hpp.
| PlaneType FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::v[sl_] |
Actual tensor data.
Definition at line 2580 of file tiny_algebra.hpp.
Referenced by FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::Tensor3(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::convert(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::copy(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::copy_n(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator()(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator*=(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator+=(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator-=(), FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator=(), and FEAT::Tiny::Tensor3< T_, l_, m_, n_, sl_, sm_, sn_ >::operator[]().