1 // note the difference between equ(a,b) which
2 // creates the matrix a whereas elm(a,b) assert
3 // compatible dimensions of a and b: if a is (m,n)
4 // then b can be (m,n) (m,1) (1,n) or (1,1)
5 program elm1;
6 uses mtx09;
7 var
8 a, b: mtx;
9 begin
10 equ(a,'1 2 3; 4 5 6'); // create and assign a
11 equ(b,a); // create and assign b
12 mwr(b);
13 elm(col(a,1),1/3); // modify 1st col. of a
14 mwr(a);
15 elm(lgn(a,2,3),1/4); // modify rows 2..3 of a
16 mwr(a);
17 elm(dia(a),0); // modify diagonal elem.
18 mwr(a);
19 elm(a,b); // a(i,j)=b(i,j) for all i,j
20 elm(b,0.0); // b(i,j) = 0 for all i,j
21 end.
22 {
23 1 2 3
24 4 5 6
25
26 0.333333 2 3
27 0.333333 5 6
28
29 0.333333 2 3
30 0.250000 0.250000 0.250000
31
32 0 2 3
33 0.250000 0 0.250000
34
35 }