Skip to content

Commit a5c8cb7

Browse files
committed
b128tclosure to be tested
1 parent 98ffeb7 commit a5c8cb7

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/c.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
3434
- name: b128 test
3535
run: |
36-
util/sparsetr -s 40000 web/cnr80k.txt -o web/cnr40k.txt
36+
util/sparsetr.py -s 40000 web/cnr80k.txt -o web/cnr40k.txt
3737
./b128sparse.x -s 40000 web/cnr40k.txt -o web/cnr40k.b128
3838
./b128unary.x web/cnr40k.b128
3939
./matrixcmp.x web/cnr40k.txt web/cnr40k.b128.0.txt

k2tclosure.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <time.h>
1919
#include <limits.h>
2020
#include <math.h>
21+
2122
// definitions to be used for b128 vs k2t-encoded matrices
2223
#ifdef K2MAT
2324
#include "k2.h"
@@ -100,12 +101,14 @@ int main (int argc, char **argv) {
100101
fprintf(stdout," %s",argv[i]);
101102
fputs("\n",stdout);
102103
}
104+
#ifdef K2MAT
103105
if(depth_subtree!=0 && (node_limit!=0 || node_limit_multiplier!=1))
104106
quit("Options -D and -N/-M are incompatible",__LINE__,__FILE__);
105107
if(node_limit!=0 && node_limit_multiplier!=1)
106108
quit("Options -N and -M are incompatible",__LINE__,__FILE__);
107109
if(depth_subtree<0 || node_limit<0)
108110
quit("Options -D and -N must be non-negative",__LINE__,__FILE__);
111+
#endif
109112

110113
// virtually get rid of options from the command line
111114
optind -=1;
@@ -161,10 +164,18 @@ int main (int argc, char **argv) {
161164
#endif
162165
if(verbose) mshow_stats(&a,"Current matrix",stdout);
163166
k2mat_t b=K2MAT_INITIALIZER;
167+
#ifdef K2MAT
168+
if(verbose) printf("Adding identity\n");
164169
mmake_pointer(&a,&b);
165170
madd_identity(&b); // b = a + I
166171
if(verbose) printf("Multiplying (A+I)A\n");
167172
mmult(&b,&a,&aIa); // aIa = (a+I)a
173+
#else
174+
if(verbose) printf("Multiplying A*A\n");
175+
mmult(&a,&a,&aIa); // aIa now is A^2
176+
if(verbose) printf("Computing A*A + A\n");
177+
madd(&aIa,&a); // aIa = A^2 + A
178+
#endif
168179
if(verbose) printf("Checking if fixed point\n");
169180
if(mequals(&a,&aIa)==true) break;
170181
k2mat_t temp = a; a = aIa; aIa = temp; // swap a and aIa for the next iteration

0 commit comments

Comments
 (0)