Files
cppdraft_translate/cppdraft/linalg/layout/packed/obs.md
2025-10-25 03:02:53 +03:00

3.2 KiB
Raw Blame History

[linalg.layout.packed.obs]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.6 Layouts for packed matrix types [linalg.layout.packed]

29.9.6.3 Observers [linalg.layout.packed.obs]

🔗

constexpr index_type required_span_size() const noexcept;

1

#

Returns: extents_.extent(0) * (extents_.extent(0) + 1)/2.

[Note 1:

For example, a 5 x 5 packed matrix only stores 15 matrix elements.

— end note]

🔗

template<class Index0, class Index1> constexpr index_type operator() (Index0 ind0, Index1 ind1) const noexcept;

2

#

Constraints:

is_convertible_v<Index0, index_type> is true,

is_convertible_v<Index1, index_type> is true,

is_nothrow_constructible_v<index_type, Index0> is true, and

is_nothrow_constructible_v<index_type, Index1> is true.

3

#

Let i be extents_type::index-cast(ind0), and let j be extents_type::index-cast(ind1).

4

#

Preconditions: i, j is a multidimensional index in extents_ ([mdspan.overview]).

5

#

Returns: Let N be extents_.extent(0).

Then

(*this)(j, i) if i > j is true; otherwise

i + j * (j + 1)/2 ifis_same_v<StorageOrder, column_major_t> && is_same_v<Triangle, upper_triangle_t> is true oris_same_v<StorageOrder, row_major_t> && is_same_v<Triangle, lower_triangle_t> is true; otherwise

j + N * i - i * (i + 1)/2.

🔗

constexpr index_type stride(rank_type r) const noexcept;

6

#

Preconditions:

is_strided() is true, and

r < extents_type::rank() is true.

7

#

Returns: 1.

🔗

template<class OtherExtents> friend constexpr bool operator==(const mapping& x, const mapping<OtherExtents>& y) noexcept;

8

#

Effects: Equivalent to: return x.extents() == y.extents();