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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### Specializations of `submdspan_mapping` <a id="mdspan.sub.map">[[mdspan.sub.map]]</a>
|
| 2 |
+
|
| 3 |
+
###### Common <a id="mdspan.sub.map.common">[[mdspan.sub.map.common]]</a>
|
| 4 |
+
|
| 5 |
+
The following elements apply to all functions in [[mdspan.sub.map]].
|
| 6 |
+
|
| 7 |
+
*Constraints:* `sizeof...(slices)` equals `extents_type::rank()`.
|
| 8 |
+
|
| 9 |
+
*Mandates:* For each rank index k of `extents()`, exactly one of the
|
| 10 |
+
following is true:
|
| 11 |
+
|
| 12 |
+
- Sₖ models `convertible_to<index_type>`,
|
| 13 |
+
- Sₖ models `index-pair-like<index_type>`,
|
| 14 |
+
- `is_convertible_v<Sₖ, full_extent_t>` is `true`, or
|
| 15 |
+
- Sₖ is a specialization of `strided_slice`.
|
| 16 |
+
|
| 17 |
+
*Preconditions:* For each rank index k of `extents()`, all of the
|
| 18 |
+
following are `true`:
|
| 19 |
+
|
| 20 |
+
- if Sₖ is a specialization of `strided_slice`, `sₖ.extent` is equal to
|
| 21 |
+
zero or `sₖ.stride` is greater than zero; and
|
| 22 |
+
- $0 \leq \tcode{\exposid{first_}<index_type, $k$>(slices...)} \\
|
| 23 |
+
\hphantom{0 } \leq \tcode{\exposid{last_}<$k$>(extents(), slices...)} \\
|
| 24 |
+
\hphantom{0 } \leq \tcode{extents().extent($k$)}$
|
| 25 |
+
|
| 26 |
+
Let `sub_ext` be the result of `submdspan_extents(extents(), slices...)`
|
| 27 |
+
and let `SubExtents` be `decltype(sub_ext)`.
|
| 28 |
+
|
| 29 |
+
Let `sub_strides` be an
|
| 30 |
+
`array<SubExtents::index_type, SubExtents::rank()>` such that for each
|
| 31 |
+
rank index k of `extents()` for which `map-rank[k]` is not
|
| 32 |
+
`dynamic_extent`, `sub_strides[map-rank[k]]` equals:
|
| 33 |
+
|
| 34 |
+
- `stride(k) * de-ice(sₖ.stride)` if Sₖ is a specialization of
|
| 35 |
+
`strided_slice` and `sₖ.stride < sₖ.extent` is `true`;
|
| 36 |
+
- otherwise, `stride(k)`.
|
| 37 |
+
|
| 38 |
+
Let `P` be a parameter pack such that
|
| 39 |
+
`is_same_v<make_index_sequence<rank()>, index_sequence<P...>>` is
|
| 40 |
+
`true`.
|
| 41 |
+
|
| 42 |
+
If `first_<index_type, k>(slices...)` equals `extents().extent(k)` for
|
| 43 |
+
any rank index k of `extents()`, then let `offset` be a value of type
|
| 44 |
+
`size_t` equal to `(*this).required_span_size()`. Otherwise, let
|
| 45 |
+
`offset` be a value of type `size_t` equal to
|
| 46 |
+
`(*this)(first_<index_type, P>(slices...)...)`.
|
| 47 |
+
|
| 48 |
+
Given a layout mapping type `M`, a type `S` is a *unit-stride slice for
|
| 49 |
+
`M`* if
|
| 50 |
+
|
| 51 |
+
- `S` is a specialization of `strided_slice` where `S::stride_type`
|
| 52 |
+
models `integral-constant-like` and `S::stride_type::value` equals
|
| 53 |
+
`1`,
|
| 54 |
+
- `S` models `index-pair-like<M::index_type>`, or
|
| 55 |
+
- `is_convertible_v<S, full_extent_t>` is `true`.
|
| 56 |
+
|
| 57 |
+
###### `layout_left` specialization of `submdspan_mapping` <a id="mdspan.sub.map.left">[[mdspan.sub.map.left]]</a>
|
| 58 |
+
|
| 59 |
+
``` cpp
|
| 60 |
+
template<class Extents>
|
| 61 |
+
template<class... SliceSpecifiers>
|
| 62 |
+
constexpr auto layout_left::mapping<Extents>::submdspan-mapping-impl(
|
| 63 |
+
SliceSpecifiers... slices) const -> see below;
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
*Returns:*
|
| 67 |
+
|
| 68 |
+
- `submdspan_mapping_result{*this, 0}`, if `Extents::rank() == 0` is
|
| 69 |
+
`true`;
|
| 70 |
+
- otherwise,
|
| 71 |
+
`submdspan_mapping_result{layout_left::mapping(sub_ext), offset}`, if
|
| 72 |
+
`SubExtents::rank() == 0` is `true`;
|
| 73 |
+
- otherwise,
|
| 74 |
+
`submdspan_mapping_result{layout_left::mapping(sub_ext), offset}`, if
|
| 75 |
+
- for each k in the range \[`0`, `SubExtents::rank() - 1)`),
|
| 76 |
+
`is_convertible_v<`Sₖ`, full_extent_t>` is `true`; and
|
| 77 |
+
- for k equal to `SubExtents::rank() - 1`, Sₖ is a unit-stride slice
|
| 78 |
+
for `mapping`;
|
| 79 |
+
|
| 80 |
+
\[*Note 2*: If the above conditions are true, all Sₖ with k larger
|
| 81 |
+
than `SubExtents::rank() - 1` are convertible to
|
| 82 |
+
`index_type`. — *end note*]
|
| 83 |
+
- otherwise,
|
| 84 |
+
``` cpp
|
| 85 |
+
submdspan_mapping_result{layout_left_padded<S_static>::mapping(sub_ext, stride(u + 1)),
|
| 86 |
+
offset}
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
if for a value u for which u+1 is the smallest value p larger than
|
| 90 |
+
zero for which Sₚ is a unit-stride slice for `mapping`, the following
|
| 91 |
+
conditions are met:
|
| 92 |
+
- S₀ is a unit-stride slice for `mapping`; and
|
| 93 |
+
- for each k in the range \[u` + 1`, u` + SubExtents::rank() - 1`),
|
| 94 |
+
`is_convertible_v<`Sₖ`, full_extent_t>` is `true`; and
|
| 95 |
+
- for k equal to u` + SubExtents::rank() - 1`, Sₖ is a unit-stride
|
| 96 |
+
slice for `mapping`;
|
| 97 |
+
|
| 98 |
+
and where `S_static` is:
|
| 99 |
+
- `dynamic_extent`, if `static_extent(`k`)` is `dynamic_extent` for
|
| 100 |
+
any k in the range \[`0`, u` + 1`),
|
| 101 |
+
- otherwise, the product of all values `static_extent(`k`)` for k in
|
| 102 |
+
the range \[`0`, u` + 1`);
|
| 103 |
+
- otherwise,
|
| 104 |
+
``` cpp
|
| 105 |
+
submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
###### `layout_right` specialization of `submdspan_mapping` <a id="mdspan.sub.map.right">[[mdspan.sub.map.right]]</a>
|
| 109 |
+
|
| 110 |
+
``` cpp
|
| 111 |
+
template<class Extents>
|
| 112 |
+
template<class... SliceSpecifiers>
|
| 113 |
+
constexpr auto layout_right::mapping<Extents>::submdspan-mapping-impl(
|
| 114 |
+
SliceSpecifiers... slices) const -> see below;
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
*Returns:*
|
| 118 |
+
|
| 119 |
+
- `submdspan_mapping_result{*this, 0}`, if `Extents::rank() == 0` is
|
| 120 |
+
`true`;
|
| 121 |
+
- otherwise,
|
| 122 |
+
`submdspan_mapping_result{layout_right::mapping(sub_ext), offset}`, if
|
| 123 |
+
`SubExtents::rank() == 0` is `true`;
|
| 124 |
+
- otherwise,
|
| 125 |
+
`submdspan_mapping_result{layout_right::mapping(sub_ext), offset}`, if
|
| 126 |
+
- for each k in the range \[*`rank_`*` - SubExtents::rank() + 1`,
|
| 127 |
+
*`rank_`*), `is_convertible_v<`Sₖ`, full_extent_t>` is `true`; and
|
| 128 |
+
- for k equal to *rank\_* - `SubExtents::rank()`, Sₖ is a unit-stride
|
| 129 |
+
slice for `mapping`;
|
| 130 |
+
|
| 131 |
+
\[*Note 3*: If the above conditions are true, all Sₖ with
|
| 132 |
+
$k < \texttt{\textit{rank_} - SubExtents::rank()}$ are convertible to
|
| 133 |
+
`index_type`. — *end note*]
|
| 134 |
+
- otherwise,
|
| 135 |
+
``` cpp
|
| 136 |
+
submdspan_mapping_result{layout_right_padded<S_static>::mapping(sub_ext,
|
| 137 |
+
stride(rank_ - u - 2)), offset}
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
if for a value u for which rank_ - u - 2 is the largest value p
|
| 141 |
+
smaller than *`rank_`*` - 1` for which Sₚ is a unit-stride slice for
|
| 142 |
+
`mapping`, the following conditions are met:
|
| 143 |
+
- for k equal to *`rank_`*` - 1`, Sₖ is a unit-stride slice for
|
| 144 |
+
`mapping`; and
|
| 145 |
+
- for each k in the range
|
| 146 |
+
\[*`rank_`*` - SubExtents::rank() - `u` + 1`,
|
| 147 |
+
*`rank_`*` - `u` - 1`), `is_convertible_v<`Sₖ`, full_extent_t>` is
|
| 148 |
+
`true`; and
|
| 149 |
+
- for k equal to *`rank_`*` - SubExtents::rank() - `u, Sₖ is a
|
| 150 |
+
unit-stride slice for `mapping`;
|
| 151 |
+
|
| 152 |
+
and where `S_static` is:
|
| 153 |
+
- `dynamic_extent`, if `static_extent(`k`)` is `dynamic_extent` for
|
| 154 |
+
any k in the range \[*`rank_`*` - `u` - 1`, *`rank_`*),
|
| 155 |
+
- otherwise, the product of all values `static_extent(`k`)` for k in
|
| 156 |
+
the range \[*`rank_`*` - `u` - 1`, *`rank_`*);
|
| 157 |
+
- otherwise,
|
| 158 |
+
``` cpp
|
| 159 |
+
submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
###### `layout_stride` specialization of `submdspan_mapping` <a id="mdspan.sub.map.stride">[[mdspan.sub.map.stride]]</a>
|
| 163 |
+
|
| 164 |
+
``` cpp
|
| 165 |
+
template<class Extents>
|
| 166 |
+
template<class... SliceSpecifiers>
|
| 167 |
+
constexpr auto layout_stride::mapping<Extents>::submdspan-mapping-impl(
|
| 168 |
+
SliceSpecifiers... slices) const -> see below;
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
*Returns:*
|
| 172 |
+
|
| 173 |
+
- `submdspan_mapping_result{*this, 0}`, if `Extents::rank() == 0` is
|
| 174 |
+
`true`;
|
| 175 |
+
- otherwise,
|
| 176 |
+
``` cpp
|
| 177 |
+
submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
###### `layout_left_padded` specialization of `submdspan_mapping` <a id="mdspan.sub.map.leftpad">[[mdspan.sub.map.leftpad]]</a>
|
| 181 |
+
|
| 182 |
+
``` cpp
|
| 183 |
+
template<class Extents>
|
| 184 |
+
template<class... SliceSpecifiers>
|
| 185 |
+
constexpr auto layout_left_padded::mapping<Extents>::submdspan-mapping-impl(
|
| 186 |
+
SliceSpecifiers... slices) const -> see below;
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
*Returns:*
|
| 190 |
+
|
| 191 |
+
- `submdspan_mapping_result{*this, 0}`, if `Extents::rank() == 0` is
|
| 192 |
+
`true`;
|
| 193 |
+
- otherwise,
|
| 194 |
+
`submdspan_mapping_result{layout_left::mapping(sub_ext), offset}`, if
|
| 195 |
+
*`rank_`*` == 1` is `true` or `SubExtents::rank() == 0` is `true`;
|
| 196 |
+
- otherwise,
|
| 197 |
+
`submdspan_mapping_result{layout_left::mapping(sub_ext), offset}`, if
|
| 198 |
+
- `SubExtents::rank() == 1` is `true` and
|
| 199 |
+
- S₀ is a unit-stride slice for `mapping`;
|
| 200 |
+
- otherwise,
|
| 201 |
+
``` cpp
|
| 202 |
+
submdspan_mapping_result{layout_left_padded<S_static>::mapping(sub_ext, stride(u + 1)),
|
| 203 |
+
offset}
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
if for a value u for which u` + 1` is the smallest value p larger than
|
| 207 |
+
zero for which Sₚ is a unit-stride slice for `mapping`, the following
|
| 208 |
+
conditions are met:
|
| 209 |
+
- S₀ is a unit-stride slice for `mapping`; and
|
| 210 |
+
- for each k in the range \[u` + 1`, u` + SubExtents::rank() - 1`),
|
| 211 |
+
`is_convertible_v<`Sₖ`, full_extent_t>` is `true`; and
|
| 212 |
+
- for k equal to u` + SubExtents::rank() - 1`, Sₖ is a unit-stride
|
| 213 |
+
slice for `mapping`;
|
| 214 |
+
|
| 215 |
+
where `S_static` is:
|
| 216 |
+
- `dynamic_extent`, if *static-padding-stride* is `dynamic_extent` or
|
| 217 |
+
`static_extent(`k`)` is `dynamic_extent` for any k in the range
|
| 218 |
+
\[`1`, u` + 1`),
|
| 219 |
+
- otherwise, the product of *static-padding-stride* and all values
|
| 220 |
+
`static_extent(`k`)` for k in the range \[`1`, u` + 1`);
|
| 221 |
+
- otherwise,
|
| 222 |
+
``` cpp
|
| 223 |
+
submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
###### `layout_right_padded` specialization of `submdspan_mapping` <a id="mdspan.sub.map.rightpad">[[mdspan.sub.map.rightpad]]</a>
|
| 227 |
+
|
| 228 |
+
``` cpp
|
| 229 |
+
template<class Extents>
|
| 230 |
+
template<class... SliceSpecifiers>
|
| 231 |
+
constexpr auto layout_right_padded::mapping<Extents>::submdspan-mapping-impl(
|
| 232 |
+
SliceSpecifiers... slices) const -> see below;
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
*Returns:*
|
| 236 |
+
|
| 237 |
+
- `submdspan_mapping_result{*this, 0}`, if *`rank_`*` == 0` is `true`;
|
| 238 |
+
- otherwise,
|
| 239 |
+
`submdspan_mapping_result{layout_right::mapping(sub_ext), offset}`, if
|
| 240 |
+
*`rank_`*` == 1` is `true` or `SubExtents::rank() == 0` is `true`;
|
| 241 |
+
- otherwise,
|
| 242 |
+
`submdspan_mapping_result{layout_right::mapping(sub_ext), offset}`, if
|
| 243 |
+
- `SubExtents::rank() == 1` is `true` and
|
| 244 |
+
- for k equal to *`rank_`*` - 1`, Sₖ is a unit-stride slice for
|
| 245 |
+
`mapping`;
|
| 246 |
+
- otherwise,
|
| 247 |
+
``` cpp
|
| 248 |
+
submdspan_mapping_result{layout_right_padded<S_static>::mapping(sub_ext,
|
| 249 |
+
stride(rank_ - u - 2)), offset}
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
if for a value u for which *`rank_`*` - `u` - 2` is the largest value
|
| 253 |
+
p smaller than *`rank_`*` - 1` for which Sₚ is a unit-stride slice for
|
| 254 |
+
`mapping`, the following conditions are met:
|
| 255 |
+
- for k equal to *`rank_`*` - 1`, Sₖ is a unit-stride slice for
|
| 256 |
+
`mapping`; and
|
| 257 |
+
- for each k in the range
|
| 258 |
+
\[*`rank_`*` - SubExtents::rank() - `u` + 1`,
|
| 259 |
+
*`rank_`*` - `u` - 1)`), `is_convertible_v<`Sₖ`, full_extent_t>` is
|
| 260 |
+
`true`; and
|
| 261 |
+
- for k equal to *`rank_`*` - SubExtents::rank() - `u, Sₖ is a
|
| 262 |
+
unit-stride slice for `mapping`;
|
| 263 |
+
|
| 264 |
+
and where `S_static` is:
|
| 265 |
+
- `dynamic_extent` if *static-padding-stride* is `dynamic_extent` or
|
| 266 |
+
for any k in the range \[*`rank_`*` - `u` - 1`, *`rank_`*` - 1`)
|
| 267 |
+
`static_extent(`k`)` is `dynamic_extent`,
|
| 268 |
+
- otherwise, the product of *static-padding-stride* and all values
|
| 269 |
+
`static_extent(`k`)` with k in the range \[*`rank_`*` - `u` - 1`,
|
| 270 |
+
*`rank_`*` - 1`);
|
| 271 |
+
- otherwise,
|
| 272 |
+
``` cpp
|
| 273 |
+
submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}
|
| 274 |
+
```
|
| 275 |
+
|