1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #include <iomanip>
- #include "config.hpp"
- #include "coeffs.hpp"
- #include "polygon_generator.hpp"
- #include "avx_matrix.hpp"
- static const size_t numbers[]=
- {
- 1,
- 2,
- 7,
- 28,
- 124,
- 588,
- 2938,
- 15268,
- 81826,
- 449572,
- 2521270,
- 14385376,
- 83290424,
- 488384528,
- 2895432660,
- 17332874364,
- 104653427012,
- 636737003384
- };
- void box(string str){
- size_t w=str.size();
- cout<<"\u250c";
- for(size_t i=0;i<w+2;++i) cout<<"\u2500";
- cout<<"\u2510"<<endl;
- cout<<"\u2502 "<<str<<" \u2502"<<endl;
- cout<<"\u2514";
- for(size_t i=0;i<w+2;++i) cout<<"\u2500";
- cout<<"\u2518"<<endl;
- }
- void disp_info(){
- box("Compute Fp's series of Self Avoiding Polygon");
- cout<<endl;
- cout<<" Maximal length is "<<max_len<<endl;
- }
- int main(){
- cout<<std::setprecision(20);
- disp_info();
- compute_coeffs();
- size_t nb[max_len/2];
- Reel res[max_len/2];
- Reel coeff[max_len/2];
- for(size_t i=0;2*i<max_len;++i){
- nb[i]=0;
- res[i]=0;
- }
- PolygonGenerator gen;
- size_t total=0;
- Polygon P;
- while(gen.next()){
- P=gen.get();
- size_t l=P.length;
- ++nb[l/2-1];
- ++total;
- Reel fp=P.fp();
- res[l/2-1]+=fp;
- }
- Reel d=256;
- for(size_t i=1;2*i<max_len;++i){
- Reel l=2*i+2;
- cout<<endl<<"=== Length "<<l<<" ==="<<endl;
- Reel r=res[i];
- Reel n=2*l;
- coeff[i]=(n*r)/d;
- cout<<" > number : "<<nb[i]<<endl;
- cout<<" > value : "<<coeff[i]<<endl;
- d*=16;
- }
- cout<<endl<<">>> Total : "<<total<<endl;
- cout<<endl<<">>> Coefficients list : "<<endl;
- for(size_t i=1;2*i<max_len;++i){
- cout<<coeff[i]<<" ";
- }
- cout<<endl;
-
- }
|