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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. Young_Tableau (int Nr, int Nc, long long int idnr); // constructs the tableau corresponding to identification number idnr
  34. Young_Tableau (const Young_Tableau& RefTableau); // copy constructor
  35. Young_Tableau (int Nr, int Nc, const Young_Tableau& RefTableau);
  36. Young_Tableau& operator= (const Young_Tableau& RefTableau); // assignment
  37. ~Young_Tableau (); // destructor
  38. public:
  39. Young_Tableau& Compute_Map (long long int idnr_to_reach); // fills the map vector
  40. Young_Tableau& Distribute_boxes (int nboxes_to_dist, int level);
  41. Young_Tableau& Set_to_id (long long int idnr); // sets the tableau to the one corresponding to idnr
  42. Young_Tableau& Set_to_id (long long int idnr, int option); // sets the tableau to the one corresponding to idnr according to rule option
  43. Young_Tableau& Set_Row_L (Vect<int>& Row_Lengths); // set row lengths
  44. Young_Tableau& Set_Col_L_given_Row_L (); // sets the Col_L array self-consistently
  45. Young_Tableau& Set_Row_L_given_Col_L (); // sets the Col_L array self-consistently
  46. long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L, int Nrows_Desc, int Ncols_Desc,
  47. const Young_Tableau& RefTableau);
  48. Young_Tableau& Compute_id(); // computes the id number of tableau
  49. Young_Tableau& Compute_id(int option); // computes the id number of tableau according to rule option
  50. Young_Tableau& Print(); // couts the tableau
  51. bool Lower_Row (int i);
  52. bool Raise_Row (int i);
  53. bool Lower_Col (int i);
  54. bool Raise_Col (int i);
  55. bool Raise_Lowest_Nonzero_Row(); // adds a box to the lowest nonzero length Row, recomputes id, returns true if tableau has changed
  56. bool Raise_Next_to_Lowest_Nonzero_Row(); // same thing, but for Row under lowest nonzero length one.
  57. bool Move_Box_from_Col_to_Col (int ifrom, int ito);
  58. Vect<Young_Tableau> Descendents (int fixed_Nboxes);
  59. Vect<Young_Tableau> Descendents_Boosted_State (int fixed_Nboxes);
  60. int Add_Boxes_From_Lowest (int Nboxes); // tries to add Nboxes to Tableau, returns number of boxes added.
  61. };
  62. std::ostream& operator<< (std::ostream& s, const Young_Tableau& tableau);
  63. inline int Nr_Nonzero_Rows (const Vect<Young_Tableau>& Tableau_ref)
  64. {
  65. // This function checks the number of rows containing at least one box
  66. // in the whole vector of Young tableaux given as argument.
  67. // The usefulness is to force descent of states in which only a few
  68. // excitations have started dispersing.
  69. int nr_nonzero_rows = 0;
  70. for (int i = 0; i < Tableau_ref.size(); ++i)
  71. for (int alpha = 0; alpha < Tableau_ref[i].Nrows; ++alpha)
  72. if (Tableau_ref[i].Row_L[alpha] > 0) nr_nonzero_rows++;
  73. return(nr_nonzero_rows);
  74. }
  75. //***********************************************************************
  76. class Tableau_Map {
  77. public:
  78. Vect<long long int> map;
  79. long long int idnr_reached;
  80. int nboxes_reached;
  81. public:
  82. Tableau_Map (int Nrows, int Ncols);
  83. void Distribute_id (int nboxes_to_dist, int level, Young_Tableau& RefTableau);
  84. };
  85. } // namespace ABACUS
  86. #endif