Skip to content

Commit 98ffeb7

Browse files
committed
fixing tests
1 parent 158affb commit 98ffeb7

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/c.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
./k2sparse.x -d web/goo120k.k2 -o web/goo120k.txt
3333
3434
- name: b128 test
35+
run: |
3536
util/sparsetr -s 40000 web/cnr80k.txt -o web/cnr40k.txt
3637
./b128sparse.x -s 40000 web/cnr40k.txt -o web/cnr40k.b128
3738
./b128unary.x web/cnr40k.b128

b128ops.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ size_t mshow_stats(const b128mat_t *a, const char *mname,FILE *file) {
155155
// check if two b128 compressed matrices :a and :b are equal
156156
// if a==b return -1
157157
// if a!=b return the row index>=0 containing the first difference
158-
int mequals_plain(size_t size, const b128mat_t *a, const b128mat_t *b)
158+
static int mequals_aux(size_t size, const b128mat_t *a, const b128mat_t *b)
159159
{
160160
(void) size;
161161
assert(a!=NULL && b!=NULL);
@@ -169,7 +169,7 @@ int mequals_plain(size_t size, const b128mat_t *a, const b128mat_t *b)
169169
bool mequals(const b128mat_t *a, const b128mat_t *b) {
170170
assert(a!=NULL && b!=NULL);
171171
if(a->size != b->size) return false; // cannot say
172-
return mequals_plain(0, a, b) < 0;
172+
return mequals_aux(0, a, b) < 0;
173173
}
174174

175175
// add indentity matrix to a
@@ -220,6 +220,21 @@ void msum(const b128mat_t *a, const b128mat_t *b, b128mat_t *c)
220220
return;
221221
}
222222

223+
// logically add matrix b to a
224+
void madd(b128mat_t *a, const b128mat_t *b)
225+
{
226+
assert(a!=NULL && b!=NULL);
227+
if(a->size != b->size)
228+
quit("madd: matrix size mismatch",__LINE__,__FILE__);
229+
230+
for(size_t i=0; i<a->size*a->colb; i++)
231+
a->b[i] = a->b[i] | b->b[i];
232+
return;
233+
}
234+
235+
236+
237+
223238
// main entry point for matrix multiplication.
224239
// multiply size x size b128 compressed matrices :a and :b storing
225240
// the result in c, old content of c is discarded

0 commit comments

Comments
 (0)