From b94be0e98bd2d802784c36e0011013edb580f6f8 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 15 Jan 2023 22:00:28 +0100 Subject: Two more cspan docs fixes. --- docs/cspan_api.md | 16 ++++++++-------- include/stc/cspan.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/cspan_api.md b/docs/cspan_api.md index 2ee9c864..2cb4dc73 100644 --- a/docs/cspan_api.md +++ b/docs/cspan_api.md @@ -9,12 +9,12 @@ See the c++ class [std::mdspan](https://en.cppreference.com/w/cpp/container/mdsp ```c #include -using_cspan(SpanType, ValueType, Rank); // define SpanType with ValueType elements. - // Rank is number of dimensions (max 4 atm.) +using_cspan(SpanType, ValueType, Rank); // define SpanType with ValueType elements. + // Rank is number of dimensions (max 4 atm.) // Shorthands: -using_cspan2(S, ValueType); // define span types S1, S2 with Ranks 1, 2. -using_cspan3(S, ValueType); // define span types S1, S2, S3 with Ranks 1, 2, 3. -using_cspan4(S, ValueType); // define span types S1.., S4 with Ranks 1, 2, 3, 4. +using_cspan2(S, ValueType); // define span types S1, S2 with Ranks 1, 2. +using_cspan3(S, ValueType); // define span types S1, S2, S3 with Ranks 1, 2, 3. +using_cspan4(S, ValueType); // define span types S1.., S4 with Ranks 1, 2, 3, 4. ``` ## Methods @@ -24,7 +24,7 @@ SpanType cspan_from(STCContainer* cnt); // c SpanType cspan_from_array(ValueType array[]); // create a 1D cspan from a C array. SpanType& cspan_literal(SpanType, {val1, val2, ...}); // create a 1D cspan compound literal -void cspan_reshape(const SpanType* self, size_t xdim, ...); // change the extent of each dimension +void cspan_reshape(const SpanType* self, size_t xdim, ...); // change the extent of each dimension size_t cspan_size(const SpanType* self); // return number of elements unsigned cspan_rank(const SpanType* self); // return number of dimensions @@ -36,8 +36,8 @@ SpanType2 cspan_slice2(SpanType2* self, size_t x0, size_t width); // g SpanType3 cspan_slice3(SpanType3* self, size_t x0, size_t width); // get a slice of a 3D cspan SpanType4 cspan_slice4(SpanType4* self, size_t x0, size_t width); // get a slice of a 4D cspan -// Ex usage 1: MySpan2 ms2 = cspan_3to2(&ms3, ms3.dim[0]-1); // last x slice -// Ex usage 2: ms2 = (MySpan2)cspan_3to2(&ms3, 0); // first x slice + // Ex usage 1: MySpan2 ms2 = cspan_3to2(&ms3, ms3.dim[0]-1); + // Ex usage 2: ms2 = (MySpan2)cspan_3to2(&ms3, 0); SpanType3 cspan_4to3(SpanType4* self, size_t x); // return a 3D subspan SpanType2 cspan_4to2(SpanType4* self, size_t x, size_t y); // return a 2D subspan SpanType1 cspan_4to1(SpanType4* self, size_t x, size_t y, size_t z); // return a 1D subspan diff --git a/include/stc/cspan.h b/include/stc/cspan.h index f5114a11..1a432a4d 100644 --- a/include/stc/cspan.h +++ b/include/stc/cspan.h @@ -35,12 +35,12 @@ int demo1() { for (size_t j=0; j