SVN r8748

This commit is contained in:
Jordan Sherer
2018-06-14 21:27:34 -04:00
parent 419c039d08
commit 4f1fe4fc94
581 changed files with 69338 additions and 39836 deletions
@@ -1,431 +0,0 @@
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.
@@ -1,80 +0,0 @@
/* MOD2CONVERT-TEST. C - Program to test mod2convert module. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
/* Correct output for this program is saved in the file mod2convert-test-out */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "mod2dense.h"
#include "mod2sparse.h"
#include "mod2convert.h"
#include "rand.h"
#define Rows 40 /* Dimensions of matrix to use in test */
#define Cols 13
#define N 100 /* Number of bits to set in test matrix (some may be
duplicates, leading to fewer 1's in matrix */
main(void)
{
mod2sparse *sm1, *sm2;
mod2dense *dm1, *dm2;
int i;
sm1 = mod2sparse_allocate(Rows,Cols);
sm2 = mod2sparse_allocate(Rows,Cols);
dm1 = mod2dense_allocate(Rows,Cols);
dm2 = mod2dense_allocate(Rows,Cols);
printf("\nCreating sparse matrix.\n");
fflush(stdout);
for (i = 0; i<N; i++)
{ mod2sparse_insert(sm1,rand_int(Rows),rand_int(Cols));
}
printf("Converting from sparse to dense.\n");
fflush(stdout);
mod2sparse_to_dense(sm1,dm1);
printf("Converting back to dense again.\n");
fflush(stdout);
mod2dense_to_sparse(dm1,sm2);
printf("Testing for equality of two sparse matrices: %s.\n",
mod2sparse_equal(sm1,sm2) ? "OK" : "NOT OK");
fflush(stdout);
printf("Converting to dense once again.\n");
fflush(stdout);
mod2sparse_to_dense(sm2,dm2);
printf("Testing for equality of two dense matrices: %s.\n",
mod2dense_equal(dm1,dm2) ? "OK" : "NOT OK");
fflush(stdout);
printf("\nDONE WITH TESTS.\n");
exit(0);
}