lustrec / test / src / arrays_arnaud / generic1.lus @ 0cbf0839
History  View  Annotate  Download (773 Bytes)
1 
type choice = enum { one, two }; 

2 
type entier = int; 
3  
4 
const PI = 3; 
5  
6 
const tab = [1.,2.,3.,4.]; 
7  
8 
const M1 = [ [ 2.1 ], [ 1.0 ], [ 3.0 ], [ 4.2 ] ] ; 
9 
const M2 = [ [ 1.1, 2.2, 1.0, 1.0 ] ] ; 
10  
11 
function _MatMul_real ( 
12 
const n, m, p : int ; 
13 
in1 : real^n^m ; 
14 
in2 : real^m^p) 
15 
returns ( 
16 
out : real^n^p) ; 
17  
18 
imported node imp1(const m:int; a:int^(PI*m)) returns (c:int^m); 
19  
20 
imported node imp2(const n:int; a:int^n) returns (d:int^n); 
21  
22 
node mult( 
23 
in1 : real^4^1) 
24 
returns ( 
25 
out : real^1^1) 
26 
var l,p; 
27 
let 
28 
l = [ tab, [3.,4.,5.,6.] ]; 
29 
p = l + [tab,tab+[3.,4.,5.,6.]]; 
30 
out = _MatMul_real (1,4,1,[ [ 2.1 ], [ 1.0 ], [ 3.0 ], [ 4.2 ] ], in1); 
31 
tel 
32 

33 
node base(const p:int; x:int^(PI*p)) returns (y:int^p) 
34 
var z:int^(PI*p); 
35 
let 
36 
z = imp2(PI*p, x); 
37 
y = imp1(p, z); 
38 
tel 
39 