File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ test/*.capacity
14
14
test/*.cm
15
15
test/*.plot
16
16
test/*.sim
17
+ test/*.hist_test
17
18
sample_error
18
19
channel_hist
19
20
log
24
25
drop_samples
25
26
row_average
26
27
test_sparse
28
+ test_hist
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ row_average: row_average.o ${SPARSE_OBJS}
106
106
107
107
TEST_MATRICES =matrix1
108
108
109
+ HIST_TEST =matrix1
110
+
109
111
ifdef BIGMEM
110
112
# This matrix requires 2.5GB of memory to build, and roughly 2*ncores GB
111
113
# to simulate
@@ -117,6 +119,9 @@ TEST_TARGETS= \
117
119
$(patsubst % ,test/% .capacity,${TEST_MATRICES}) \
118
120
$(patsubst % ,test/% .sim,${TEST_MATRICES})
119
121
122
+ HIST_TEST_TARGETS = \
123
+ $(patsubst % ,test/% .hist_test,${HIST_TEST})
124
+
120
125
% .cm : % .samples.xz channel_matrix
121
126
xzcat $< | ./channel_matrix $@
122
127
@@ -129,7 +134,10 @@ TEST_TARGETS= \
129
134
% .sim : % .cm sample_error
130
135
./sample_error $< 100 10 1e-3 1 0 1 > $@
131
136
132
- test : ${TEST_TARGETS} test_sparse
137
+ % .hist_test : % .samples.xz test_hist
138
+ xzcat $< | ./test_hist > $@
139
+
140
+ test : ${TEST_TARGETS} ${HIST_TEST_TARGETS} test_sparse
133
141
./test_sparse
134
142
135
143
# ##
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ main(int argc, char *argv[]) {
56
56
57
57
printf (" done.\n" );
58
58
59
+ if (!bsc_check (H , 1 )) abort ();
60
+
59
61
bsc_stats (H );
60
62
61
63
col = malloc (H -> end_row * sizeof (int ));
@@ -64,19 +66,21 @@ main(int argc, char *argv[]) {
64
66
exit (EXIT_FAILURE );
65
67
}
66
68
67
- printf ("Recounting all entries...\n " );
69
+ printf ("Recounting all entries..." );
68
70
fflush (stdout );
69
71
70
72
for (c = 0 ; c < H -> end_col ; c ++ ) {
71
73
size_t i ;
72
- if (c != 0 && c % 10 == 0 )
73
- printf ("%d/%d\n" , c , H -> end_col );
74
74
bzero (col , H -> end_row * sizeof (int ));
75
75
if (H -> end_rows [c ] <= H -> start_rows [c ]) continue ;
76
76
for (i = 0 ; i < nread ; i ++ ) {
77
- if (data [i ].c == c ) col [data [i ].r ]++ ;
77
+ if (data [i ].c == c ) {
78
+ assert (H -> start_rows [c ] <= data [i ].r );
79
+ assert (data [i ].r < H -> end_rows [c ]);
80
+ col [data [i ].r ]++ ;
81
+ }
78
82
}
79
- for (r = H -> start_rows [c ]; r < H -> end_rows [c ]; r ++ ) {
83
+ for (r = H -> start_rows [c ]; r < H -> end_rows [c ] && r < H -> end_row ; r ++ ) {
80
84
int ri = r - H -> start_rows [c ];
81
85
82
86
if (col [r ] != H -> entries [c ][ri ]) {
You can’t perform that action at this time.
0 commit comments