This directory contains text files which are to be post-processed
with the utility slice (http://www.engelschall.com/sw/slice) to
create the actual files (for example, C source code) of interest.

Slice looks for markers in the template file. It generates variations of
the template file by including or excluding text within one or more sets
of markers.  Here is a sample template for a C function which adds dense
matrices.  The template encodes three vatiations of matrix addition:

  1.  a real    matrix plus a real    matrix (RR)
  2.  a complex matrix plus a real    matrix (CR)
  3.  a complex matrix plus a complex matrix (CC)

---------------------\/ template.c \/---------------------
int add_[CC:cc:][CR:cr:][RR:rr:](int nR, 
           int nC, 
           matrix_[CC:c:][CR:c:][RR:r:] *A, 
           matrix_[CC:c:][CR:r:][RR:r:] *B, 
           matrix_[CC:c:][CR:c:][RR:r:] *C) 
{
    int r, c;
    for (c = 0; c < nC; c++) 
        for (r = 0; r < nR; r++) {
            [CC:
            C[r][c].re = A[r][c].re + B[r][c].re;
            C[r][c].im = A[r][c].im + B[r][c].im;
            :]
            [CR:
            C[r][c].re = A[r][c].re + B[r][c];
            C[r][c].im = A[r][c].im;
            :]
            [RR:C[r][c] = A[r][c] + B[r][c]:];
        }
}
---------------------/\ template.c /\---------------------

The   [CC:   :]  markers surround code which will be used in the 
complex-complex case,  [CR:  :] surrounds complex-real, et cetera.
To generate the three separate C functions,
invoke the slice utility with the command

  slice -o CCuUNDEF:- -o CRuUNDEF:- -o RRuUNDEF:- template.c > add.c

to get a new file add.c which looks like this:

---------------------\/ add.c \/---------------------
int add_cc(int nR, 
           int nC, 
           matrix_c *A, 
           matrix_c *B, 
           matrix_c *C) 
{
    int r, c;
    for (c = 0; c < nC; c++) 
        for (r = 0; r < nR; r++) {
            
            C[r][c].re = A[r][c].re + B[r][c].re;
            C[r][c].im = A[r][c].im + B[r][c].im;
            
            
            ;
        }
}
int add_cr(int nR, 
           int nC, 
           matrix_c *A, 
           matrix_r *B, 
           matrix_c *C) 
{
    int r, c;
    for (c = 0; c < nC; c++) 
        for (r = 0; r < nR; r++) {
            
            
            C[r][c].re = A[r][c].re + B[r][c];
            C[r][c].im = A[r][c].im;
            
            ;
        }
}
int add_rr(int nR, 
           int nC, 
           matrix_r *A, 
           matrix_r *B, 
           matrix_r *C) 
{
    int r, c;
    for (c = 0; c < nC; c++) 
        for (r = 0; r < nR; r++) {
            
            
            C[r][c] = A[r][c] + B[r][c];
        }
}
---------------------/\ add.c /\---------------------
