summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-03 22:37:59 +0100
committerTyge Løvset <[email protected]>2023-02-03 22:37:59 +0100
commit2f370b34484e63359f9fd2850b72d3d1d8dfc32a (patch)
tree609fc076aca1f1d218cdbd95379cf795349dce92 /misc/examples
parentcd806510c7c77c0618af58bd804e36f2bad6d219 (diff)
downloadSTC-modified-2f370b34484e63359f9fd2850b72d3d1d8dfc32a.tar.gz
STC-modified-2f370b34484e63359f9fd2850b72d3d1d8dfc32a.zip
Renamed dim to shape in cspan. Not 100% sure it will survive.
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/multidim.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/multidim.c b/misc/examples/multidim.c
index 49d7fbc4..e61959ca 100644
--- a/misc/examples/multidim.c
+++ b/misc/examples/multidim.c
@@ -19,9 +19,9 @@ int main()
ispan3 ms3 = cspan_md(v.data, 2, 3, 4);
puts("ms3:");
- for (int i=0; i != ms3.dim[0]; i++) {
- for (int j=0; j != ms3.dim[1]; j++) {
- for (int k=0; k != ms3.dim[2]; k++) {
+ for (int i=0; i != ms3.shape[0]; i++) {
+ for (int j=0; j != ms3.shape[1]; j++) {
+ for (int k=0; k != ms3.shape[2]; k++) {
printf(" %2d", *cspan_at(&ms3, i, j, k));
}
puts("");
@@ -33,9 +33,9 @@ int main()
//cspan_slice(&ss3, {c_ALL}, {1,3}, {1,3});
ss3 = cspan_slice(ispan3, &ms3, {c_ALL}, {1,3}, {1,3});
- for (int i=0; i != ss3.dim[0]; i++) {
- for (int j=0; j != ss3.dim[1]; j++) {
- for (int k=0; k != ss3.dim[2]; k++) {
+ for (int i=0; i != ss3.shape[0]; i++) {
+ for (int j=0; j != ss3.shape[1]; j++) {
+ for (int k=0; k != ss3.shape[2]; k++) {
printf(" %2d", *cspan_at(&ss3, i, j, k));
}
puts("");
@@ -51,8 +51,8 @@ int main()
ispan2 ms2 = cspan_submd3(&ms3, 0);
// write data using 2D view
- for (int i=0; i != ms2.dim[0]; i++)
- for (int j=0; j != ms2.dim[1]; j++)
+ for (int i=0; i != ms2.shape[0]; i++)
+ for (int j=0; j != ms2.shape[1]; j++)
*cspan_at(&ms2, i, j) = i*1000 + j;
puts("\nview data as 1D view:");