|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Symmetric rank-2 tensor: stores only D*(D+1)/2 independent components. More...
#include <symmetric.hpp>
Public Types | |
| using | value_type = Value |
| using | reference = Value& |
| using | const_reference = const Value& |
| using | size_type = std::size_t |
Public Member Functions | |
| symmetric_tensor ()=default | |
| symmetric_tensor (const Value &val) | |
| reference | operator() (size_type i, size_type j) |
| Access: automatically symmetrizes indices. | |
| const_reference | operator() (size_type i, size_type j) const |
| tensor< Value, 2, Dim > | to_full () const |
| Convert to a full (non-symmetric) tensor. | |
| symmetric_tensor & | operator+= (const symmetric_tensor &other) |
| symmetric_tensor & | operator-= (const symmetric_tensor &other) |
| symmetric_tensor & | operator*= (const Value &s) |
| bool | operator== (const symmetric_tensor &other) const |
| bool | operator!= (const symmetric_tensor &other) const |
Static Public Member Functions | |
| static constexpr size_type | stored_size () |
| Number of stored (independent) components. | |
| static symmetric_tensor | from_full (const tensor< Value, 2, Dim > &t) |
| Construct from a full tensor (symmetrizes by averaging). | |
Static Public Attributes | |
| static constexpr size_type | rank = 2 |
| static constexpr size_type | dimension = Dim |
| static constexpr size_type | num_stored = detail_sym::sym2_count(Dim) |
| static constexpr size_type | num_components = Dim * Dim |
Friends | |
| symmetric_tensor | operator+ (symmetric_tensor a, const symmetric_tensor &b) |
| symmetric_tensor | operator- (symmetric_tensor a, const symmetric_tensor &b) |
| symmetric_tensor | operator* (symmetric_tensor a, const Value &s) |
| symmetric_tensor | operator* (const Value &s, symmetric_tensor a) |
Symmetric rank-2 tensor: stores only D*(D+1)/2 independent components.
T(i,j) == T(j,i) is enforced structurally.
| using mtl::tensor::symmetric_tensor< Value, Dim >::const_reference = const Value& |
| using mtl::tensor::symmetric_tensor< Value, Dim >::reference = Value& |
| using mtl::tensor::symmetric_tensor< Value, Dim >::size_type = std::size_t |
| using mtl::tensor::symmetric_tensor< Value, Dim >::value_type = Value |
|
default |
|
inlineexplicit |
|
inlinestatic |
Construct from a full tensor (symmetrizes by averaging).
For an integer Value the average is an integer division, so it truncates: from_full of an integer tensor is exact only when it is already symmetric.
|
inline |
|
inline |
Access: automatically symmetrizes indices.
Checked against Dim under bounds_checking, as tensor's access is (#857: no check at all).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticconstexpr |
Number of stored (independent) components.
|
inline |
Convert to a full (non-symmetric) tensor.
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |