monoid.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include <iostream>
  2. #include "monoid.hpp"
  3. void init_full_N(monoid &m)
  4. {
  5. epi8 block ={1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8};
  6. for(auto i=0; i<NBLOCKS; i++){
  7. m.blocks[i] = block;
  8. block = block + 8;
  9. }
  10. m.genus = 0;
  11. m.conductor = 1;
  12. m.min = 1;
  13. m.left=1;
  14. m.left_primitive=0;
  15. m.e=1;
  16. m.wilf=0;
  17. }
  18. void init_ordinary(monoid &O,int m){
  19. O.decs[0]=1;
  20. for(auto i=1;i<2*m;++i){
  21. O.decs[i]=i/m;
  22. }
  23. for(auto i=0;i<SIZE-2*m;++i){
  24. O.decs[2*m+i]=2+i/2;
  25. }
  26. O.genus = m-1;
  27. O.conductor = m;
  28. O.min = m;
  29. O.left=1;
  30. O.left_primitive=0;
  31. O.e=m;
  32. O.wilf=0;
  33. }
  34. void print_monoid(const monoid &m)
  35. {
  36. unsigned int i;
  37. std::cout<<"min = "<<m.min<<", cond = "<<m.conductor<<", genus = "<<m.genus<<", decs = ";
  38. for (i=0; i<SIZE; i++) std::cout<<((int) m.decs[i])<<' ';
  39. std::cout<<std::endl;
  40. }
  41. void print_monoid_gen(const monoid &m)
  42. {
  43. unsigned int i;
  44. std::cout<<"m = "<<m.min<<", c = "<<m.conductor<<", g = "<<m.genus<<" w = "<<m.wilf<<" ";
  45. std::cout<<"< ";
  46. for (i=1; i<SIZE; i++){
  47. if(m.decs[i]==1){
  48. std::cout<<i<<' ';
  49. }
  50. }
  51. std::cout<<'>'<<std::endl;
  52. }
  53. #include <cmath>
  54. void output(const monoid& m,fstream& f){
  55. int q=ceil(float(m.conductor)/float(m.min));
  56. int rho=q*m.min-m.conductor;
  57. f<<"c = "<<m.conductor<<", g = "<<m.genus<<", r = "<<rho<<", w = "<<m.wilf<<" : ["<<m.min;
  58. for (auto i=m.min+1; i<SIZE; i++){
  59. if(m.decs[i]==1){
  60. f<<','<<i;
  61. }
  62. }
  63. f<<']'<<endl;
  64. }
  65. void print_epi8(epi8 bl)
  66. {
  67. unsigned int i;
  68. for (i=0; i<16; i++) std::cout<<((uint8_t*)&bl)[i]<<' ';
  69. std::cout<<std::endl;
  70. }