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

SCM Repository

[diderot] Annotation of /branches/vis15/src/tests/new-tests/global-sum-test.diderot
ViewVC logotype

Annotation of /branches/vis15/src/tests/new-tests/global-sum-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4386 - (view) (download)

1 : jhr 4328 /* global-sum-test.diderot
2 :     *
3 :     * This program tests the use of global reductions in a program.
4 :     *
5 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
6 :     *
7 :     * COPYRIGHT (c) 2016 The University of Chicago
8 :     * All rights reserved.
9 :     */
10 :    
11 : jhr 4386 real total = 1.0;
12 : jhr 4328
13 :     strand S (int i) {
14 :     output real e = i;
15 :    
16 :     update {
17 :     real e' = real(i) / total;
18 :     if (e == e') {
19 :     stabilize;
20 :     } else {
21 :     e = e';
22 :     }
23 :     }
24 :    
25 :     }
26 :    
27 :     collection { S(i) | i in 1..10 }
28 :    
29 :     initially {
30 :     total = sum { p.e | p in S.all };
31 : jhr 4386 print("initially: total = ", total, "\n");
32 : jhr 4328 }
33 :    
34 :     update {
35 :     total = sum { p.e | p in S.all };
36 : jhr 4386 print("update: total = ", total, "\n");
37 : jhr 4328 }

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