SCM Repository
View of /tests/new-tests/global-var-test.diderot
Parent Directory
|
Revision Log
Revision 4640 -
(download)
(annotate)
Tue Sep 27 20:54:47 2016 UTC (3 years, 2 months ago) by glk
File size: 659 byte(s)
Tue Sep 27 20:54:47 2016 UTC (3 years, 2 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 |