432 lines
3.2 KiB
Plaintext
432 lines
3.2 KiB
Plaintext
|
|
||
|
PART 1:
|
||
|
|
||
|
Matrix m1:
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2 3
|
||
|
3: 3
|
||
|
4: 4
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 10 38
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 4 34
|
||
|
|
||
|
Matrix m2, as read from file. Should be same as m1 above.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2 3
|
||
|
3: 3
|
||
|
4: 4
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 10 38
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 4 34
|
||
|
|
||
|
Test of equality of m1 & m2 (should be 1): 1
|
||
|
|
||
|
Matrix m3, copied from m1 above.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2 3
|
||
|
3: 3
|
||
|
4: 4
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 10 38
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 4 34
|
||
|
|
||
|
Test of equality of m1 & m3 (should be 1): 1
|
||
|
|
||
|
Matrix m3 again, should now be all zeros.
|
||
|
|
||
|
0:
|
||
|
1:
|
||
|
2:
|
||
|
3:
|
||
|
4:
|
||
|
5:
|
||
|
6:
|
||
|
7:
|
||
|
8:
|
||
|
9:
|
||
|
10:
|
||
|
11:
|
||
|
12:
|
||
|
13:
|
||
|
14:
|
||
|
15:
|
||
|
16:
|
||
|
17:
|
||
|
18:
|
||
|
19:
|
||
|
20:
|
||
|
21:
|
||
|
22:
|
||
|
23:
|
||
|
24:
|
||
|
25:
|
||
|
26:
|
||
|
27:
|
||
|
28:
|
||
|
29:
|
||
|
30:
|
||
|
31:
|
||
|
32:
|
||
|
33:
|
||
|
34:
|
||
|
|
||
|
Test of equality of m1 & m3 (should be 0): 0
|
||
|
|
||
|
|
||
|
PART 2:
|
||
|
|
||
|
Transpose of m1.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2
|
||
|
3: 2 3
|
||
|
4: 4 34
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 10
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 34
|
||
|
35:
|
||
|
36:
|
||
|
37:
|
||
|
38: 10
|
||
|
39:
|
||
|
|
||
|
Matrix m1 after adding rows 2 and 12 and 3 to 10.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2 3
|
||
|
3: 3
|
||
|
4: 4
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 2 10 12 38
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 4 34
|
||
|
|
||
|
Matrix m1 after further adding column 34 to 0.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2 3
|
||
|
3: 3
|
||
|
4: 4
|
||
|
5: 5
|
||
|
6: 6
|
||
|
7: 7
|
||
|
8: 8
|
||
|
9: 9
|
||
|
10: 2 10 12 38
|
||
|
11: 11
|
||
|
12: 12
|
||
|
13: 13
|
||
|
14: 14
|
||
|
15: 15
|
||
|
16: 16
|
||
|
17: 17
|
||
|
18: 18
|
||
|
19: 19
|
||
|
20: 20
|
||
|
21: 21
|
||
|
22: 22
|
||
|
23: 23
|
||
|
24: 24
|
||
|
25: 25
|
||
|
26: 26
|
||
|
27: 27
|
||
|
28: 28
|
||
|
29: 29
|
||
|
30: 30
|
||
|
31: 31
|
||
|
32: 32
|
||
|
33: 33
|
||
|
34: 0 4 34
|
||
|
|
||
|
|
||
|
PART 3:
|
||
|
|
||
|
Matrix s0.
|
||
|
|
||
|
0:
|
||
|
1: 3 4
|
||
|
2: 0
|
||
|
3: 1
|
||
|
4:
|
||
|
|
||
|
Matrix s1.
|
||
|
|
||
|
0:
|
||
|
1: 3 5
|
||
|
2:
|
||
|
3: 0 1 6
|
||
|
4:
|
||
|
|
||
|
Matrix s2.
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2:
|
||
|
3:
|
||
|
4:
|
||
|
5: 1 2 3
|
||
|
6:
|
||
|
|
||
|
Maxtrix s1 times unpacked vector ( 1 0 0 1 0 1 0 ).
|
||
|
|
||
|
( 0 0 0 1 0 )
|
||
|
|
||
|
Sum of s0 and s1.
|
||
|
|
||
|
0:
|
||
|
1: 4 5
|
||
|
2: 0
|
||
|
3: 0 6
|
||
|
4:
|
||
|
|
||
|
Product of s1 and s2.
|
||
|
|
||
|
0:
|
||
|
1: 1 2 3
|
||
|
2:
|
||
|
3: 0 1
|
||
|
4:
|
||
|
|
||
|
Tried to find (1,2), actually found: (1,2)
|
||
|
|
||
|
Above matrix with (1,2) cleared.
|
||
|
|
||
|
0:
|
||
|
1: 1 3
|
||
|
2:
|
||
|
3: 0 1
|
||
|
4:
|
||
|
|
||
|
Tried to find (1,1), actually found: (1,1)
|
||
|
|
||
|
Matrix with (1,1) cleared as well.
|
||
|
|
||
|
0:
|
||
|
1: 3
|
||
|
2:
|
||
|
3: 0 1
|
||
|
4:
|
||
|
|
||
|
|
||
|
PART 4:
|
||
|
|
||
|
Matrix s1.
|
||
|
|
||
|
0: 3 5
|
||
|
1: 1 6
|
||
|
2: 0
|
||
|
3: 1 2
|
||
|
4: 0 2
|
||
|
5: 6
|
||
|
|
||
|
LU decomposition (returned value was 0).
|
||
|
|
||
|
L=
|
||
|
0: 3
|
||
|
1: 1
|
||
|
2: 0
|
||
|
3: 1 2
|
||
|
4: 0 2 4
|
||
|
5:
|
||
|
|
||
|
U=
|
||
|
0: 0
|
||
|
1: 1 6
|
||
|
2: 2 6
|
||
|
3: 3
|
||
|
4: 6
|
||
|
|
||
|
cols: 0 1 2 3 6 5 4
|
||
|
rows: 2 1 3 0 4 5
|
||
|
|
||
|
Product of L and U.
|
||
|
|
||
|
0: 3
|
||
|
1: 1 6
|
||
|
2: 0
|
||
|
3: 1 2
|
||
|
4: 0 2
|
||
|
5:
|
||
|
|
||
|
Solution of Ly=x with x from ( 0 1 1 0 1 0 ) according to rows selected.
|
||
|
|
||
|
1 1 1 0 1
|
||
|
|
||
|
Returned value from forward_sub was 1
|
||
|
|
||
|
Solution of Uz=y.
|
||
|
|
||
|
1 0 0 0 0 0 1
|
||
|
|
||
|
Returned value from backward_sub was 1
|
||
|
|
||
|
|
||
|
PART 5:
|
||
|
|
||
|
Matrix m1:
|
||
|
|
||
|
0: 3
|
||
|
1: 1
|
||
|
2: 2
|
||
|
3: 0
|
||
|
|
||
|
Matrix m2, copyrows of m1 in order 3,1,2,0 (should be identity)
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2
|
||
|
3: 3
|
||
|
|
||
|
Matrix m3, copycols of m1 in order 3,1,2,0 (should be identity)
|
||
|
|
||
|
0: 0
|
||
|
1: 1
|
||
|
2: 2
|
||
|
3: 3
|
||
|
|
||
|
|
||
|
DONE WITH TESTS.
|