MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::tensor::detail_sym Namespace Reference

Functions

constexpr std::size_t sym2_count (std::size_t D)
 Number of independent components for a symmetric rank-2 tensor in D dimensions.
constexpr std::size_t sym2_index (std::size_t i, std::size_t j, std::size_t D)
 Map (i, j) with i <= j to a flat index in upper-triangular storage.
constexpr std::size_t asym2_count (std::size_t D)
 Number of independent components for an antisymmetric rank-2 tensor.
constexpr std::size_t asym2_index (std::size_t i, std::size_t j, std::size_t D)
 Map (i, j) with i < j to a flat index. Returns D*(D-1)/2 for diagonal.

Function Documentation

◆ asym2_count()

std::size_t mtl::tensor::detail_sym::asym2_count ( std::size_t D)
constexpr

Number of independent components for an antisymmetric rank-2 tensor.

◆ asym2_index()

std::size_t mtl::tensor::detail_sym::asym2_index ( std::size_t i,
std::size_t j,
std::size_t D )
constexpr

Map (i, j) with i < j to a flat index. Returns D*(D-1)/2 for diagonal.

◆ sym2_count()

std::size_t mtl::tensor::detail_sym::sym2_count ( std::size_t D)
constexpr

Number of independent components for a symmetric rank-2 tensor in D dimensions.

◆ sym2_index()

std::size_t mtl::tensor::detail_sym::sym2_index ( std::size_t i,
std::size_t j,
std::size_t D )
constexpr

Map (i, j) with i <= j to a flat index in upper-triangular storage.

Storage order: (0,0), (0,1), (0,2), ..., (1,1), (1,2), ..., (D-1,D-1)