#include #include #include #include "l.h" #define pdm 0 #define mc 1 R min(R x, R y){return x1) { int y=k; while(y--) dp[y] = at.a[k*a.c[i*a.d+iv] + y] - at.a[k*a.c[i*a.d] + y]; dp += k;}} {int iv=b.d; while(iv-->1) { int y=k; while(y--) dp[y] = bt.a[k*b.c[j*b.d+iv] + y] - bt.a[k*b.c[j*b.d] + y]; dp += k;}} if(mc){{int y=k; while(y--) dp[y] = at.a[k*a.c[i*a.d] + y] - bt.a[k*b.c[j*b.d] + y];} int const sz = 1000; R ave = 0; {int sn=sz; while(sn--) if(0){ave += 1./pw(smp((R*)D, a.d-1, b.d-1));} /// arghh!! .... double printing alternative else {R p = smp((R*)D, a.d-1, b.d-1); if(0) printf("vne r=%8.5f\n", sqrt(p)); ave += pw(1./p);} if(pdm){pm((mat){D, k, k}, "D"); R d = det(D, k, k); printf("d=%e ave=%e, sz=%d\n", d, ave, sz); intg += d*ave/sz;} else intg += det(D, k, k)*ave/sz;}} else {R r2 = 0; {int y=k; while(y--){R dx = cntb[j][y] - cnta[i][y]; dp[y] = dx; if(0) printf("fwhh dx=%e cntb[%d][%d] = %e " "cnta[%d][%d] = %e dp-D=%d\n", dx, j, y, cntb[j][y], i, y, cnta[i][y], dp-D); r2 += dx*dx;}} R rk = pw(r2); if(pdm){pm((mat){D, k, k}, "D"); R d = det(D, k, k); intg += d/rk; printf("(%d %d) d = %e rk=%e r2=%e\n", i, j, d, rk, r2);} else intg += det(D, k, k)/rk; r2m = r2