tmp/tmpur9_m4wg/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### `submdspan_extents` function <a id="mdspan.sub.extents">[[mdspan.sub.extents]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class IndexType, size_t... Extents, class... SliceSpecifiers>
|
| 5 |
+
constexpr auto submdspan_extents(const extents<IndexType, Extents...>& src,
|
| 6 |
+
SliceSpecifiers... slices);
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
*Constraints:* `sizeof...(slices)` equals `sizeof...(Extents)`.
|
| 10 |
+
|
| 11 |
+
*Mandates:* For each rank index k of `src.extents()`, exactly one of the
|
| 12 |
+
following is true:
|
| 13 |
+
|
| 14 |
+
- Sₖ models `convertible_to<IndexType>`,
|
| 15 |
+
- Sₖ models `index-pair-like<IndexType>`,
|
| 16 |
+
- `is_convertible_v<`Sₖ`, full_extent_t>` is `true`, or
|
| 17 |
+
- Sₖ is a specialization of `strided_slice`.
|
| 18 |
+
|
| 19 |
+
*Preconditions:* For each rank index k of `src.extents()`, all of the
|
| 20 |
+
following are `true`:
|
| 21 |
+
|
| 22 |
+
- if Sₖ is a specialization of `strided_slice`
|
| 23 |
+
- `$s_k$.extent` = 0, or
|
| 24 |
+
- `$s_k$.stride` > 0
|
| 25 |
+
- $0 \le \texttt{\textit{first_}<IndexType, $k$>(slices...)}$
|
| 26 |
+
$\le \texttt{\textit{last_}<$k$>(src, slices...)}$ ≤ `src.extent($k$)`
|
| 27 |
+
|
| 28 |
+
Let `SubExtents` be a specialization of `extents` such that:
|
| 29 |
+
|
| 30 |
+
- `SubExtents::rank()` equals the number of k such that Sₖ does not
|
| 31 |
+
model `convertible_to<IndexType>`; and
|
| 32 |
+
- for each rank index k of `Extents` such that
|
| 33 |
+
*`map-rank`*`[`k`] != dynamic_extent` is `true`,
|
| 34 |
+
`SubExtents::static_extent(`*`map-rank`*`[`k`])` equals:
|
| 35 |
+
- `Extents::static_extent(`k`)` if
|
| 36 |
+
`is_convertible_v<`Sₖ`, full_extent_t>` is `true`; otherwise
|
| 37 |
+
- *`de-ice`*`(tuple_element_t<1, `Sₖ`>()) -`
|
| 38 |
+
*`de-ice`*`(tuple_element_t<0, `Sₖ`>())` if Sₖ models
|
| 39 |
+
`index-pair-like<IndexType>`, and both `tuple_element_t<0, `Sₖ`>`
|
| 40 |
+
and `tuple_element_t<1, `Sₖ`>` model `integral-constant-like`;
|
| 41 |
+
otherwise
|
| 42 |
+
- `0`, if Sₖ is a specialization of `strided_slice`, whose
|
| 43 |
+
`extent_type` models *`integral-constant-like`*, for which
|
| 44 |
+
`extent_type()` equals zero; otherwise
|
| 45 |
+
- `1 + (`*`de-ice`*`(`Sₖ`::extent_type()) - 1) /`
|
| 46 |
+
*`de-ice`*`(`Sₖ`::stride_type())`, if Sₖ is a specialization of
|
| 47 |
+
`strided_slice` whose `extent_type` and `stride_type` model
|
| 48 |
+
*`integral-constant-like`*;
|
| 49 |
+
- otherwise, `dynamic_extent`.
|
| 50 |
+
|
| 51 |
+
*Returns:* A value `ext` of type `SubExtents` such that for each k for
|
| 52 |
+
which *`map-rank`*`[`k`] != dynamic_extent` is `true`,
|
| 53 |
+
`ext.extent(`*`map-rank`*`[`k`])` equals:
|
| 54 |
+
|
| 55 |
+
- sₖ`.extent == 0 ? 0 : 1 + (`*`de-ice`*`(`sₖ`.extent) - 1) / `*`de-ice`*`(`sₖ`.stride)`
|
| 56 |
+
if Sₖ is a specialization of `strided_slice`,
|
| 57 |
+
- otherwise,
|
| 58 |
+
*`last_`*`<`k`>(src, slices...) - `*`first_`*`<IndexType, `k`>(slices...)`.
|
| 59 |
+
|