Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/lamont/test/sum-reduction/sum-reduction.diderot
 [diderot] / branches / lamont / test / sum-reduction / sum-reduction.diderot

# Diff of /branches/lamont/test/sum-reduction/sum-reduction.diderot

revision 3281, Tue Oct 13 17:05:21 2015 UTC revision 3282, Tue Oct 13 19:46:34 2015 UTC
# Line 10  Line 10
11   */   */
12  input int nNumbers;  input int nNumbers;
13  real gSum = 0;  real gVariance = 0;
14  int steps = 0;  int steps = 0;
15
16  strand Reduction (int i, real number) {  strand Reduction (int i, real number) {
# Line 18  Line 18
18      int id = i;      int id = i;
19      output real sum =0.0;      output real sum =0.0;
20      update {      update {
21          if(steps >= 3) {          if(steps >= 1) {
22              sum = gSum;              sum = gVariance;
23              print("gSum =", sum, "\n");              print("gVariance =", gVariance, "\n");
24              stabilize;              stabilize;
25           }           }
26      }      }
# Line 29  Line 29
29
30
31  global {  global {
32    /* BUG FIXES: We need reductions that allow the following:    gVariance = variance{S.num | S in Reduction.all};
* gSum = sum{S.num | S in Reduction.all} + 5;
* gSum = sum{S.num | S in Reduction.all} + sum{S.num | S in Reduction.all};
* gSum = sum{S.num | S in Reduction.all} + sum{S.num | S in Reduction.all} + 5;
* Refactor reduction production code.
*  -> Convert the lists into records and pass the various parts as records.
**/

gSum = sum{S.num | S in Reduction.all};
33    steps+=1;    steps+=1;
34  }  }
35

Legend:
 Removed from v.3281 changed lines Added in v.3282