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

SCM Repository

[diderot] View of /tests/new-tests/global-var-test.diderot
ViewVC logotype

View of /tests/new-tests/global-var-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 10 months ago) by glk
File size: 659 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
#version 2.0

/* global-sum-test.diderot
 *
 * This program tests the use of global reductions in a program.
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 */

const int N = 10;
real stdev = ∞;

strand S (int i) {
  output real e = i;

  update {
    stabilize;
  }

}

create_collection { S(i) | i in 1..N }

update {
//  real var = variance{P.energy | P in Particle.all};
  real avg = mean{ strnd.e | strnd in S.all};
  real var = sum{(avg - strnd.e)^2 | strnd in S.all};
  stdev = sqrt(var);
  print("update: stdev = ", stdev, "\n");
}

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