Ignore:
Timestamp:
Oct 28, 2022, 3:12:16 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master
Children:
fa2e183
Parents:
e874605 (diff), 22a0e87 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/programs/hello-md.cfa

    re874605 r93d2219  
    11#include "array.hfa"
    2 
    3 
    4 trait ix( C &, E &, ztype(N) ) {
    5     E & ?[?]( C &, ptrdiff_t );
    6     void __taglen( tag(C), tag(N) );
    7 };
    8 
    9 forall( ztype(Zn), ztype(S), Timmed &, Tbase & )
    10 void __taglen( tag(arpk(Zn, S, Timmed, Tbase)), tag(Zn) ) {}
    112
    123
     
    3829
    3930
    40 forall( ztype( N ) )
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40forall( [N] )
    4141void print1d_cstyle( array(float, N) & c );
    4242
    43 forall( C &, ztype( N ) | ix( C, float, N ) )
     43forall( [N], C & | ar( C, float, N ) )
    4444void print1d( C & c );
    4545
     
    5858
    5959
    60 forall( ztype( N ) )
     60forall( [N] )
    6161void print1d_cstyle( array(float, N) & c ) {
    62     for( i; z(N) ) {
     62    for( i; N ) {
    6363        printf("%.1f  ", c[i]);
    6464    }
     
    7878
    7979
    80 forall( C &, ztype( N ) | ix( C, float, N ) )
     80forall( [N], C & | ar( C, float, N ) )
    8181void print1d( C & c ) {
    82     for( i; z(N) ) {
     82    for( i; N ) {
    8383        printf("%.1f  ", c[i]);
    8484    }
     
    9999
    100100
    101 void fill( array(float, Z(5), Z(7)) & a ) {
     101void fill( array(float, 5, 7) & a ) {
    102102    for ( i; (ptrdiff_t) 5 ) {
    103103        for ( j; 7 ) {
    104             a[[i,j]] = 1.0 * i + 0.1 * j;
    105             printf("%.1f  ", a[[i,j]]);
     104            a[i,j] = 1.0 * i + 0.1 * j;
     105            printf("%.1f  ", a[i,j]);
    106106        }
    107107        printf("\n");
     
    118118
    119119
    120 array( float, Z(5), Z(7) ) a;
     120array( float, 5, 7 ) a;
    121121fill(a);
    122122/*
     
    148148
    149149
    150 print1d( a[[ 2, all ]] );  // 2.0  2.1  2.2  2.3  2.4  2.5  2.6
    151 print1d( a[[ all, 3 ]] );  // 0.3  1.3  2.3  3.3  4.3
     150print1d( a[ 2, all ] );  // 2.0  2.1  2.2  2.3  2.4  2.5  2.6
     151print1d( a[ all, 3 ] );  // 0.3  1.3  2.3  3.3  4.3
    152152
    153153
    154154
    155 print1d_cstyle( a[[ 2, all ]] );
     155print1d_cstyle( a[ 2, all ] );
    156156
    157157
     
    161161
    162162
    163 #ifdef SHOWERR1
     163#ifdef SHOW_ERROR_1
    164164
    165 print1d_cstyle( a[[ all, 2 ]] );  // bad
     165print1d_cstyle( a[ all, 2 ] );  // bad
    166166
    167167#endif
Note: See TracChangeset for help on using the changeset viewer.