summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/cspan_api.md16
-rw-r--r--include/stc/cspan.h4
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 <stc/cspan.h>
-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<ms.dim[1]; j++)
*cspan_at(&ms, i, j) = i*1000 + j;
- printf("%f\n", *cspan_at(&span, 3, 4));
+ printf("%f\n", *cspan_at(&ms, 3, 4));
}
int demo2() {
int array[] = {1, 2, 3, 4, 5};
- Intspan span = cspan_from(array);
+ Intspan span = cspan_from_array(array);
c_FOREACH (i, Intspan, span)
printf(" %d", *i.ref);