- linalg[meta header]
- function template[meta id-type]
- std::linalg[meta namespace]
- layout_blas_packed::mapping[meta class]
- cpp26[meta cpp]
template<class Index0, class Index1>
constexpr index_type operator() (Index0 ind0, Index1 ind1) const noexcept;
2次元インデクス値ind0, ind1
に対応する要素位置を求める。
is_convertible_v
<Index0, index_type> == true
is_convertible_v
<Index1, index_type> == true
is_nothrow_convertible_v
<index_type, Index0> == true
is_nothrow_convertible_v
<index_type, Index1> == true
i
をextents_type::index-cast
(ind0)
、j
をextents_type::index-cast
(ind1)
としたとき、2次元インデクス値i, j
は多次元配列サイズextents_
における有効なインデクスであること。
N
をextetns_.extent
(0)
としたとき
i > j
ならば(*this)(j, i)
、そうでなければ- 下記いずれの条件を満たすならば
i + j * (j + 1)/2
、そうでなければ j + N * i - i * (i + 1)/2
投げない
#include <cassert>
#include <mdspan>
#include <linalg>
namespace linalg = std::linalg;
int main()
{
using Ext3x3 = std::extents<size_t, 3, 3>;
linalg::layout_blas_packed<linalg::lower_triangle_t, linalg::column_major_t>::mapping<Ext3x3> map;
// 0 1 2
// 1 3 4
// 2 4 5
assert(map(0, 0) == 0);
assert(map(0, 1) == 1);
assert(map(2, 1) == 4);
}
- mapping[color ff0000]
- linalg::layout_blas_packed[link ../../layout_blas_packed.md]
- C++26
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??