Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/lamont/test/reduction/sum-reduction.diderot
ViewVC logotype

View of /branches/lamont/test/reduction/sum-reduction.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3282 - (download) (annotate)
Tue Oct 13 19:46:34 2015 UTC (4 years, 3 months ago) by lamonts
File size: 1353 byte(s)
Fixed bug with dead strands appearing in query lists
 /*! \file sum-reduction.test 
 *
 * \author Lamont Samuels
 *
 * This example tests the sum global reductions. 
 */

/*
 * COPYRIGHT (c) 2014 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */
input int nNumbers;
real gSum = 0; 
real gSum1 = 0; 
int steps = 0; 
real gMin = 0; 
bool gExists = false; 
 
strand Reduction (int i, real number) {
    real num = number; 
    int id = i; 
    output real sum =0.0; 
    update {  
        if(steps >= 1) {
            sum = gSum;  
            if(id == 0){ 
              print("gSum =", gSum, "gMin", gMin,"\n");
            }
            stabilize;
         }
    }
} 



/* global {   
//  gSum = sum{S.num | S in Reduction.all}; 
  //real g = gSum + sum{S.num | S in Reduction.all};  //+ 3; // mean{S.num + 3 | S in Reduction.all}; 
  gSum =  sum{S.num | S in Reduction.all} + mean{S.num + 3 | S in Reduction.all}; 
  //gSum1 = g;
  gMin = (5 * min{S.num + gSum + 2 | S in Reduction.all}) + 24; 
  gExists = exists{S.num < 3 | S in Reduction.active}; 

  steps= 1; 
} */

global { 
  real var = variance{P.num | P in Reduction.all}; 
  gSum = sum{S.num + 5  + var| S in Reduction.all} + sum{S.num + 9 | S in Reduction.all}; 
  gMin = (5 * min{S.num + gSum + 2 | S in Reduction.all}) + 24; 
  steps= 1; 

} 




initially { Reduction(vi,vi) | vi in 1..nNumbers}; 


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0