summaryrefslogtreecommitdiffhomepage
path: root/docs/cspan_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-15 21:43:00 +0100
committerTyge Løvset <[email protected]>2023-01-15 21:43:00 +0100
commit4c4f7a6a594f66183d33c9c8ef486c9af6fcd8fd (patch)
tree5e1123289670f7b7428592076c1a679a545fe445 /docs/cspan_api.md
parent770a39ff6ed39494569a411949f22edcdb7eb30c (diff)
downloadSTC-modified-4c4f7a6a594f66183d33c9c8ef486c9af6fcd8fd.tar.gz
STC-modified-4c4f7a6a594f66183d33c9c8ef486c9af6fcd8fd.zip
some cspan docs fixes.
Diffstat (limited to 'docs/cspan_api.md')
-rw-r--r--docs/cspan_api.md28
1 files changed, 15 insertions, 13 deletions
diff --git a/docs/cspan_api.md b/docs/cspan_api.md
index 7af96c06..3e6ab7c7 100644
--- a/docs/cspan_api.md
+++ b/docs/cspan_api.md
@@ -19,23 +19,25 @@ using_cspan4(S, ValueType); // de
## Methods
```c
-SpanType& cspan_literal(SpanType, {val1, val2, ...}); // create a 1D cspan compound literal
-SpanType cspan_from_array(ValueType array[]); // create a 1D cspan from an array.
-SpanType cspan_from(STCContainer* cnt); // create a 1D cspan from a STC container;
- // cstack, cvec, cdeq, cqueue, or cpque
SpanType cspan_make(ValueType* data, size_t xdim, ...); // make N-dimensional cspan
-void cspan_reshape(const SpanType* self, size_t x, ...); // change the extent of each dimension
+SpanType cspan_from(STCContainer* cnt); // create a 1D cspan from a compatible STC container
+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
size_t cspan_size(const SpanType* self); // return number of elements
unsigned cspan_rank(const SpanType* self); // return number of dimensions
ValueType* cspan_at(SpanType* self, size_t x, ...); // access element
size_t cspan_index(const SpanType* self, size_t x, ...); // index of element
-SpanType cspan_slice1(SpanType1* self, size_t x0, size_t with); // get a slice of a 1D cspan
-SpanType cspan_slice2(SpanType2* self, size_t x0, size_t with); // get a slice of a 2D cspan
-SpanType cspan_slice3(SpanType3* self, size_t x0, size_t with); // get a slice of a 3D cspan
-SpanType cspan_slice4(SpanType4* self, size_t x0, size_t with); // get a slice of a 4D cspan
+SpanType cspan_slice1(SpanType1* self, size_t x0, size_t width); // get a slice of a 1D cspan
+SpanType cspan_slice2(SpanType2* self, size_t x0, size_t width); // get a slice of a 2D cspan
+SpanType cspan_slice3(SpanType3* self, size_t x0, size_t width); // get a slice of a 3D cspan
+SpanType 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
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
@@ -43,9 +45,9 @@ SpanType2 cspan_3to2(SpanType3* self, size_t x); // r
SpanType1 cspan_3to1(SpanType3* self, size_t x, size_t y); // return a 1D subspan
SpanType1 cspan_2to1(SpanType2* self, size_t x); // return a 1D subspan
-SpanType_iter cspan_begin(const SpanType* self);
-SpanTyåe_iter cspan_end(const SpanType* self);
-void cspan_next(SpanType_iter* it);
+SpanType_iter SpanType_begin(const SpanType* self);
+SpanTyåe_iter SpanType_end(const SpanType* self);
+void SpanType_next(SpanType_iter* it);
```
## Types
@@ -62,7 +64,7 @@ void cspan_next(SpanType_iter* it);
#include <stc/cstack.h>
#include <stc/cspan.h>
-using_cspan3(FS, float); // define spans FS1, FS2, and FS3.
+using_cspan3(FS, float); // Shorthand to define span types FS1, FS2, and FS3.
int main()
{