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

SCM Repository

[diderot] Annotation of /tests/new-tests/clamp-test.diderot
ViewVC logotype

Annotation of /tests/new-tests/clamp-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (view) (download)

1 : glk 4640 #version 2.0
2 :    
3 :     // test clamp function
4 :     //
5 :    
6 :     // FIXME: higher-order clamp
7 :     //tensor[2,2] M = [[-2, 1], [1.5, 0]];
8 :     //tensor[2,2] L = [[-1, -1], [2, 2]];
9 :     //tensor[2,2] H = [[2, 3], [3, 2.5]];
10 :     tensor[4] M = [-2, 1, 1.5, 0];
11 :     tensor[4] L = [-1, -1, 2, 2];
12 :     tensor[4] H = [2, 3, 3, 2.5];
13 :    
14 :     initialize {
15 :     print ("M = ", M, "\n");
16 :     print ("L = ", L, "\n");
17 :     print ("H = ", H, "\n");
18 :     }
19 :    
20 :     strand S () {
21 :     output real w = 0;
22 :    
23 :     update {
24 :     stabilize;
25 :     }
26 :    
27 :     }
28 :    
29 :     start {
30 :     print ("clamp(L, H, M) = ", clamp(L, H, M), "\n");
31 :     print ("clamp(0, 1, M) = ", clamp(0, 1, M), "\n");
32 :     print ("clamp(-1, 1, M) = ", clamp(-1, 1, M), "\n");
33 :     }
34 :    
35 :     create_collection { S() | i in 1..1 }

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