atlas  0.6
gradings.h
Go to the documentation of this file.
1 
5 /*
6  This is gradings.h
7 
8  Copyright (C) 2004,2005 Fokko du Cloux
9  part of the Atlas of Lie Groups and Representations
10 
11  For license information see the LICENSE file
12 */
13 
14 #ifndef GRADINGS_H /* guard against multiple inclusions */
15 #define GRADINGS_H
16 
17 
18 #include <functional> // base class |std::binary_function| for |GradingCompare|
19 
20 #include "../Atlas.h"
21 
22 #include "bitset.h"
23 
24  namespace atlas {
25 
26 /******** function declarations *********************************************/
27 
28 namespace gradings {
29 
30  RootNbrSet max_orth(const RootNbrSet& non_compact,
31  const RootNbrSet& subsys,
32  const RootSystem& rs);
33 
35  const RootNbrList&,
36  const RootNbrSet&,
37  const RootSystem&);
38 
39 }
40 
41 /******** class definitions **************************************************/
42 
43 namespace gradings {
44 
45 /*
46  The class |Status| describes a four-valued root attribute for each simple
47  root: to be real, complex, imaginary compact or imaginary noncompact.
48 
49  This information fits nicely in two bits, and these bits can then be
50  packed in a |TwoRankFlags| bitset
51 */
52 
53 class Status
54 {
56 
57  public:
58 
59  enum Value { Complex, ImaginaryCompact, Real, ImaginaryNoncompact };
60 
61 // constructors and destructors
62  Status() {} // all roots are |Complex| by default
63 
64  ~Status() {}
65 
66 // accessors
67  Value operator[] (size_t j) const
68  {
69  j *= 2;
70  unsigned u = d_flags[j] ? 1 : 0;
71  if (d_flags[j+1])
72  u+=2;
73  return static_cast<Value>(u);
74  }
75 
76  bool isComplex(size_t j) const
77  {
78  j *= 2;
79  return not d_flags[j] and not d_flags[j+1];
80  }
81 
82  bool isImaginaryCompact(size_t j) const
83  {
84  j *= 2;
85  return d_flags[j] and not d_flags[j+1];
86  }
87 
88  bool isReal(size_t j) const
89  {
90  j *= 2;
91  return not d_flags[j] and d_flags[j+1];
92  }
93 
94  bool isImaginaryNoncompact(size_t j) const
95  {
96  j *= 2;
97  return d_flags[j] and d_flags[j+1];
98  }
99 
100  bool isImaginary(size_t j) const
101  {
102  return d_flags[2*j];
103  }
104 
105  bool operator==(const Status& other) const { return d_flags==other.d_flags; }
106  bool operator!=(const Status& other) const { return d_flags!=other.d_flags; }
107 
108 // manipulators
109 
110  void set(size_t j, Value v)
111  {
112  unsigned long a = v;
113  TwoRankFlags b(a);
114  b <<= 2*j;
115  d_flags |= b;
116  }
117 
118  void set_imaginary(size_t j, bool grading)
119  {
120  TwoRankFlags b(grading ? ImaginaryNoncompact : ImaginaryCompact);
121  b <<= 2*j;
122  d_flags |= b;
123  }
124 }; // class Status
125 
126 // a comparison object. Compares bit counts first, when tied uses binary order
128  : public std::binary_function<const Grading& , const Grading& , bool>
129 {
130  bool operator() (const Grading&, const Grading&);
131 };
132 
133 } // |namespace gradings|
134 
135 } // |namespace atlas|
136 
137 #endif
bool isComplex(size_t j) const
Definition: gradings.h:76
void set_imaginary(size_t j, bool grading)
Definition: gradings.h:118
~Status()
Definition: gradings.h:64
void transform_grading(Grading &, const RootNbrList &, const RootNbrSet &, const RootSystem &)
bool isImaginary(size_t j) const
Definition: gradings.h:100
bool isReal(size_t j) const
Definition: gradings.h:88
BitSet< 2 *constants::RANK_MAX > TwoRankFlags
Definition: Atlas.h:61
Definition: gradings.h:53
bool isImaginaryCompact(size_t j) const
Definition: gradings.h:82
Definition: gradings.h:127
bitmap::BitMap RootNbrSet
Definition: Atlas.h:218
Value
Definition: gradings.h:59
RootNbrSet max_orth(const RootNbrSet &non_compact, const RootNbrSet &subsys, const RootSystem &rs)
Definition: gradings.cpp:51
Definition: testrun.h:26
Definition: Atlas.h:38
bool operator!=(const Status &other) const
Definition: gradings.h:106
Class definitions and function declarations for the BitSet class.
bool isImaginaryNoncompact(size_t j) const
Definition: gradings.h:94
TwoRankFlags d_flags
Definition: gradings.h:55
RankFlags Grading
Definition: Atlas.h:289
std::vector< RootNbr > RootNbrList
Definition: Atlas.h:217
bool operator==(const Status &other) const
Definition: gradings.h:105
Status()
Definition: gradings.h:62
Grading grading
Definition: output.cpp:73
Vertex v
Definition: graph.cpp:116