You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ABACUS_Young.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: ABACUS_Young.h
  6. Purpose: Declares Young tableau class.
  7. ***********************************************************/
  8. #ifndef ABACUS_YOUNG_H
  9. #define ABACUS_YOUNG_H
  10. #include "ABACUS_Vect.h"
  11. namespace ABACUS {
  12. const int YOUNG_TABLEAU_ID_OPTION = 0;
  13. const long long int TABLEAU_ID_UPPER_LIMIT = 10000000LL;
  14. //***********************************************************************
  15. class Young_Tableau {
  16. public:
  17. int Nrows;
  18. int Ncols;
  19. int* Row_L;
  20. int* Col_L;
  21. long long int id; // identification number
  22. long long int maxid;
  23. long long int* map;
  24. bool map_computed;
  25. long long int idnr_reached;
  26. int nboxes_reached;
  27. private:
  28. int dimchoose;
  29. long long int* choose_table;
  30. public:
  31. Young_Tableau (); // empty constructor, does nothing
  32. Young_Tableau (int Nr, int Nc); // constructs empty tableau
  33. // constructs the tableau with identification number idnr:
  34. Young_Tableau (int Nr, int Nc, long long int idnr);
  35. Young_Tableau (const Young_Tableau& RefTableau); // copy constructor
  36. Young_Tableau (int Nr, int Nc, const Young_Tableau& RefTableau);
  37. Young_Tableau& operator= (const Young_Tableau& RefTableau); // assignment
  38. ~Young_Tableau (); // destructor
  39. public:
  40. Young_Tableau& Compute_Map (long long int idnr_to_reach); // fills the map vector
  41. Young_Tableau& Distribute_boxes (int nboxes_to_dist, int level);
  42. Young_Tableau& Set_to_id (long long int idnr); // sets the tableau to the one corresponding to idnr
  43. // sets the tableau to the one corresponding to idnr according to rule option:
  44. Young_Tableau& Set_to_id (long long int idnr, int option);
  45. Young_Tableau& Set_Row_L (Vect<int>& Row_Lengths); // set row lengths
  46. Young_Tableau& Set_Col_L_given_Row_L (); // sets the Col_L array self-consistently
  47. Young_Tableau& Set_Row_L_given_Col_L (); // sets the Col_L array self-consistently
  48. long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L,
  49. int Nrows_Desc, int Ncols_Desc,
  50. const Young_Tableau& RefTableau);
  51. Young_Tableau& Compute_id(); // computes the id number of tableau
  52. Young_Tableau& Compute_id(int option); // computes the id number of tableau according to rule option
  53. Young_Tableau& Print(); // couts the tableau
  54. bool Lower_Row (int i);
  55. bool Raise_Row (int i);
  56. bool Lower_Col (int i);
  57. bool Raise_Col (int i);
  58. // adds a box to the lowest nonzero length Row, recomputes id, returns true if tableau has changed:
  59. bool Raise_Lowest_Nonzero_Row();
  60. bool Raise_Next_to_Lowest_Nonzero_Row(); // same thing, but for Row under lowest nonzero length one.
  61. bool Move_Box_from_Col_to_Col (int ifrom, int ito);
  62. Vect<Young_Tableau> Descendents (int fixed_Nboxes);
  63. Vect<Young_Tableau> Descendents_Boosted_State (int fixed_Nboxes);
  64. int Add_Boxes_From_Lowest (int Nboxes); // tries to add Nboxes to Tableau, returns number of boxes added.
  65. };
  66. std::ostream& operator<< (std::ostream& s, const Young_Tableau& tableau);
  67. inline int Nr_Nonzero_Rows (const Vect<Young_Tableau>& Tableau_ref)
  68. {
  69. /*
  70. This function checks the number of rows containing at least one box
  71. in the whole vector of Young tableaux given as argument.
  72. The usefulness is to force descent of states in which only a few
  73. excitations have started dispersing.
  74. */
  75. int nr_nonzero_rows = 0;
  76. for (int i = 0; i < Tableau_ref.size(); ++i)
  77. for (int alpha = 0; alpha < Tableau_ref[i].Nrows; ++alpha)
  78. if (Tableau_ref[i].Row_L[alpha] > 0) nr_nonzero_rows++;
  79. return(nr_nonzero_rows);
  80. }
  81. //***********************************************************************
  82. class Tableau_Map {
  83. public:
  84. Vect<long long int> map;
  85. long long int idnr_reached;
  86. int nboxes_reached;
  87. public:
  88. Tableau_Map (int Nrows, int Ncols);
  89. void Distribute_id (int nboxes_to_dist, int level, Young_Tableau& RefTableau);
  90. };
  91. } // namespace ABACUS
  92. #endif