// This presents a mathmatical mystery. It says such things as ABCA'DB'C'D' = I // where only BC and AD commute. (A' is the inverse of A) #include #include #include #define d 4 #define dep 8 typedef double r; r c, s, th = 1; char hx[dep][2]; static void to(char * q, r m[d][d]){int j=d; while(j--){int k=j+1; while(k--){ int n=d; r s = 0; while(n--) s += m[j][n]*m[k][n]; {r e = s - (j==k); if(fabs(e) > 1.e-14) printf("Grock %s %d %d %e\n", q, j, k, e);}}}} int cnt=0; r o[d][d]; // the main matrix r ID[d][d]; // comparand static void id(r w[d][d]){int j=d; while(j--){int k=d; while(k--) w[j][k] = j==k;}} static r sq(r x){return x*x;} static void twist(int f, int g){int n=d; while(n--){ r t = o[f][n], b = o[g][n]; o[f][n] = c*t+s*b; o[g][n]=-s*t+c*b;} ++cnt;} static void pt(char * m, r t[d][d]){int j, k; for(j=0; j .046) goto xx;} pt("cls", o); to("cl", o); printf("s = %e c=%d\n", s, cnt); {int j=dep; while(j-->=D) printf("%d:%d, ", hx[j][0], hx[j][1]); printf("\n\n");} xx:;} {int a=d; while(a--){int b=d; while(b--) if(a!=b && D) rec(a, b, jk, D-1);}} {int x=d; while(x--){o[j][x] = hs[0][x]; o[k][x] = hs[1][x];}}}}} int main(){s = sin(th); c = cos(th); id(o); id(ID); {int j=d; while(j--){int k=d; while(k--) if(j!=k) rec(j, k, 3<