|
18 | 18 | #include <time.h> |
19 | 19 | #include <limits.h> |
20 | 20 | #include <math.h> |
| 21 | + |
21 | 22 | // definitions to be used for b128 vs k2t-encoded matrices |
22 | 23 | #ifdef K2MAT |
23 | 24 | #include "k2.h" |
@@ -100,12 +101,14 @@ int main (int argc, char **argv) { |
100 | 101 | fprintf(stdout," %s",argv[i]); |
101 | 102 | fputs("\n",stdout); |
102 | 103 | } |
| 104 | + #ifdef K2MAT |
103 | 105 | if(depth_subtree!=0 && (node_limit!=0 || node_limit_multiplier!=1)) |
104 | 106 | quit("Options -D and -N/-M are incompatible",__LINE__,__FILE__); |
105 | 107 | if(node_limit!=0 && node_limit_multiplier!=1) |
106 | 108 | quit("Options -N and -M are incompatible",__LINE__,__FILE__); |
107 | 109 | if(depth_subtree<0 || node_limit<0) |
108 | 110 | quit("Options -D and -N must be non-negative",__LINE__,__FILE__); |
| 111 | + #endif |
109 | 112 |
|
110 | 113 | // virtually get rid of options from the command line |
111 | 114 | optind -=1; |
@@ -161,10 +164,18 @@ int main (int argc, char **argv) { |
161 | 164 | #endif |
162 | 165 | if(verbose) mshow_stats(&a,"Current matrix",stdout); |
163 | 166 | k2mat_t b=K2MAT_INITIALIZER; |
| 167 | + #ifdef K2MAT |
| 168 | + if(verbose) printf("Adding identity\n"); |
164 | 169 | mmake_pointer(&a,&b); |
165 | 170 | madd_identity(&b); // b = a + I |
166 | 171 | if(verbose) printf("Multiplying (A+I)A\n"); |
167 | 172 | 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 |
168 | 179 | if(verbose) printf("Checking if fixed point\n"); |
169 | 180 | if(mequals(&a,&aIa)==true) break; |
170 | 181 | k2mat_t temp = a; a = aIa; aIa = temp; // swap a and aIa for the next iteration |
|
0 commit comments