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

SCM Repository

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

View of /branches/lamont/test/sum-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: 700 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 gVariance = 0; 
int steps = 0; 
 
strand Reduction (int i, real number) {
    real num = number; 
    int id = i; 
    output real sum =0.0; 
    update {  
        if(steps >= 1) {
            sum = gVariance;  
            print("gVariance =", gVariance, "\n"); 
            stabilize;
         }
    }
} 



global {
  gVariance = variance{S.num | S in Reduction.all}; 
  steps+=1; 
} 

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


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