Ignore:
Timestamp:
Jul 10, 2024, 3:39:37 AM (19 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
725f777f
Parents:
bb336a6 (diff), f3811df (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

    rbb336a6 rdbff8ec  
    3939
    4040forall( [N] )
    41 void print1d_cstyle( array(float, N) & c );
     41void print1d_cstyle( array( float, N ) & r ); $\C{// C style}$
    4242
    43 forall( [N], C & | ar( C, float, N ) )
     43forall( [N], C & @| ar( C, float, N )@ ) $\C{// add trait}$
    4444void print1d( C & c );
    4545
     
    5959
    6060forall( [N] )
    61 void print1d_cstyle( array(float, N) & c ) {
    62         for ( i; N ) {
    63                 sout | c[i] | nonl;
    64         }
     61void print1d_cstyle( array( float, N ) & r ) { $\C{// C style}$
     62        for ( i; N ) sout | r[i] | nonl;
    6563        sout | nl;
    6664}
     65
     66
    6767
    6868
     
    9898
    9999
    100 void fill( array(float, 5, 7) & a ) {
     100void fill( array( float, 5, 7 ) & a ) {
    101101        for ( i; (ptrdiff_t) 5 ) {
    102102                for ( j; 7 ) {
     
    116116
    117117
    118 array( float, 5, 7 ) a;
    119 fill(a);
     118array( float, 5, 7 ) m;
     119fill( m );
    120120/*
    121 0.0  0.1  0.2  0.3  0.4  0.5  0.6 
    122 1.0  1.1  1.2  1.3  1.4  1.5  1.6 
    123 2.0  2.1  2.2  2.3  2.4  2.5  2.6 
    124 3.0  3.1  3.2  3.3  3.4  3.5  3.6 
    125 4.0  4.1  4.2  4.3  4.4  4.5  4.6
     121r/c   0     1     2     3     4     5     6
     1220  0.0  0.1  0.2  @0.3@  0.4  0.5  0.6 
     1231  1.0  1.1  1.2  @1.3@  1.4  1.5  1.6 
     1242  @2.0  2.1  2.2  2.3  2.4  2.5  2.6@ 
     1253  3.0  3.1  3.2  @3.3@  3.4  3.5  3.6 
     1264  4.0  4.1  4.2  @4.3@  4.4  4.5  4.6
    126127*/
    127128
     
    137138
    138139
    139 
    140 print1d_cstyle( a[ 2 ] );  // 2.0  2.1  2.2  2.3  2.4  2.5  2.6
     140print1d_cstyle( m[ 2 ] );  $\C{// row 2:  2.0  2.1  2.2  2.3  2.4  2.5  2.6}$
    141141
    142142
    143143
    144144
    145 print1d( a[ 2 ] );  // 2.0  2.1  2.2  2.3  2.4  2.5  2.6
     145print1d( m[ 2 ] );  $\C{// row:  2.0  2.1  2.2  2.3  2.4  2.5  2.6}$
    146146
    147147
    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( m[ 2, all ] );  $\C{// row 2:  2.0  2.1  2.2  2.3  2.4  2.5  2.6}$
     151print1d( m[ all, 3 ] );  $\C{// column 3:  0.3  1.3  2.3  3.3  4.3}$
    152152
    153153
    154154
    155 print1d_cstyle( a[ 2, all ] );
     155print1d_cstyle( m[ 2, all ] );
    156156
    157157
     
    163163#ifdef SHOW_ERROR_1
    164164
    165 print1d_cstyle( a[ all, 2 ] );  // bad
     165print1d_cstyle( m[ all, 2 ] );  $\C{// bad}$
    166166
    167167#endif
Note: See TracChangeset for help on using the changeset viewer.