PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/octave/template/runme.m

#
Objective C | 37 lines | 26 code | 11 blank | 0 comment | 4 complexity | 9f61478c5798cdc20a92c2ef1f92700e MD5 | raw file
 1# file: runme.m
 2
 3example
 4
 5# Call some templated functions
 6example.maxint(3,7)
 7example.maxdouble(3.14,2.18)
 8
 9# Create some class
10
11iv = example.vecint(100)
12dv = example.vecdouble(1000)
13
14for i=0:99,
15  iv.setitem(i,2*i);
16end
17
18for i=0:999,
19  dv.setitem(i, 1.0/(i+1));
20end;
21
22sum = 0;
23for i=0:99
24      sum = sum + iv.getitem(i);
25end
26sum
27
28sum = 0.0;
29for i=0:999,
30      sum = sum + dv.getitem(i);
31end
32sum
33
34clear iv
35clear dv
36
37