tmp/tmpolpayg95/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `layout_transpose` <a id="linalg.transp.layout.transpose">[[linalg.transp.layout.transpose]]</a>
|
| 2 |
+
|
| 3 |
+
`layout_transpose` is an `mdspan` layout mapping policy that swaps the
|
| 4 |
+
two indices, extents, and strides of any `mdspan` layout mapping policy.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
namespace std::linalg {
|
| 8 |
+
template<class Layout>
|
| 9 |
+
class layout_transpose {
|
| 10 |
+
public:
|
| 11 |
+
using nested_layout_type = Layout;
|
| 12 |
+
|
| 13 |
+
template<class Extents>
|
| 14 |
+
struct mapping {
|
| 15 |
+
private:
|
| 16 |
+
using nested-mapping-type =
|
| 17 |
+
Layout::template mapping<transpose-extents-t<Extents>>; // exposition only
|
| 18 |
+
|
| 19 |
+
public:
|
| 20 |
+
using extents_type = Extents;
|
| 21 |
+
using index_type = extents_type::index_type;
|
| 22 |
+
using size_type = extents_type::size_type;
|
| 23 |
+
using rank_type = extents_type::rank_type;
|
| 24 |
+
using layout_type = layout_transpose;
|
| 25 |
+
|
| 26 |
+
constexpr explicit mapping(const nested-mapping-type&);
|
| 27 |
+
|
| 28 |
+
constexpr const extents_type& extents() const noexcept { return extents_; }
|
| 29 |
+
|
| 30 |
+
constexpr index_type required_span_size() const
|
| 31 |
+
{ return nested-mapping_.required_span_size(); }
|
| 32 |
+
|
| 33 |
+
template<class Index0, class Index1>
|
| 34 |
+
constexpr index_type operator()(Index0 ind0, Index1 ind1) const
|
| 35 |
+
{ return nested-mapping_(ind1, ind0); }
|
| 36 |
+
|
| 37 |
+
constexpr const nested-mapping-type& nested_mapping() const noexcept
|
| 38 |
+
{ return nested-mapping_; }
|
| 39 |
+
|
| 40 |
+
static constexpr bool is_always_unique() noexcept
|
| 41 |
+
{ return nested-mapping-type::is_always_unique(); }
|
| 42 |
+
static constexpr bool is_always_exhaustive() noexcept
|
| 43 |
+
{ return nested-mapping-type::is_always_exhaustive(); }
|
| 44 |
+
static constexpr bool is_always_strided() noexcept
|
| 45 |
+
{ return nested-mapping-type::is_always_strided(); }
|
| 46 |
+
|
| 47 |
+
constexpr bool is_unique() const { return nested-mapping_.is_unique(); }
|
| 48 |
+
constexpr bool is_exhaustive() const { return nested-mapping_.is_exhaustive(); }
|
| 49 |
+
constexpr bool is_strided() const { return nested-mapping_.is_strided(); }
|
| 50 |
+
|
| 51 |
+
constexpr index_type stride(size_t r) const;
|
| 52 |
+
|
| 53 |
+
template<class OtherExtents>
|
| 54 |
+
friend constexpr bool operator==(const mapping& x, const mapping<OtherExtents>& y);
|
| 55 |
+
|
| 56 |
+
private:
|
| 57 |
+
nested-mapping-type nested-mapping_; // exposition only
|
| 58 |
+
extents_type extents_; // exposition only
|
| 59 |
+
};
|
| 60 |
+
};
|
| 61 |
+
}
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
`Layout` shall meet the layout mapping policy requirements
|
| 65 |
+
[[mdspan.layout.policy.reqmts]].
|
| 66 |
+
|
| 67 |
+
*Mandates:*
|
| 68 |
+
|
| 69 |
+
- `Extents` is a specialization of `std::extents`, and
|
| 70 |
+
- `Extents::rank()` equals 2.
|
| 71 |
+
|
| 72 |
+
``` cpp
|
| 73 |
+
constexpr explicit mapping(const nested-mapping-type& map);
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
*Effects:*
|
| 77 |
+
|
| 78 |
+
- Initializes *nested-mapping\_* with `map`, and
|
| 79 |
+
- initializes *extents\_* with *`transpose-extents`*`(map.extents())`.
|
| 80 |
+
|
| 81 |
+
``` cpp
|
| 82 |
+
constexpr index_type stride(size_t r) const;
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
*Preconditions:*
|
| 86 |
+
|
| 87 |
+
- `is_strided()` is `true`, and
|
| 88 |
+
- `r < 2` is `true`.
|
| 89 |
+
|
| 90 |
+
*Returns:* *`nested-mapping_`*`.stride(r == 0 ? 1 : 0)`
|
| 91 |
+
|
| 92 |
+
``` cpp
|
| 93 |
+
template<class OtherExtents>
|
| 94 |
+
friend constexpr bool operator==(const mapping& x, const mapping<OtherExtents>& y);
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
*Constraints:* The expression
|
| 98 |
+
`x.`*`nested-mapping_`*` == y.`*`nested-mapping_`* is well-formed and
|
| 99 |
+
its result is convertible to `bool`.
|
| 100 |
+
|
| 101 |
+
*Returns:* `x.`*`nested-mapping_`*` == y.`*`nested-mapping_`*.
|
| 102 |
+
|