33 : size(0), PI(1), Tnum(0), Znum(0)
40 : size(A), PI(1), Tnum(0), Znum(0), Tval(A)
50 for (
size_t i = 0; i <
size; cnt *= 2, i++) {
51 Tval[i] = (
X & cnt) ? 1 : -1;
54 Tnum = (sum +
static_cast<int>(
size)) / 2;
65 if (A.size != size || A.Tnum != Tnum || A.Znum != Znum)
67 auto ac = A.Tval.cbegin();
68 for (
auto vc = Tval.cbegin(); vc != Tval.cend(); ++vc, ++ac) {
69 if (ac == A.Tval.cend())
88 for (
size_t i = 0; i < size; i++) {
89 if (Tval[i] * A.Tval[i] < 0)
91 if (retval == 1 && Tval[i] != A.Tval[i])
104 return (&A !=
this) ? !(*
this < A) :
false;
116 return size < A.size;
118 return (Znum < A.Znum);
121 return (Tnum < A.Tnum);
123 auto tvc = Tval.crbegin();
124 auto avc = A.Tval.crbegin();
125 while (tvc != Tval.crend()) {
141 if (A < 0 && A >=
static_cast<int>(size))
166 std::vector<int>::iterator vc;
167 for (vc =
Tval.begin(); vc !=
Tval.end() && (*vc) != -1; ++vc) {
173 if (vc ==
Tval.end())
201 std::vector<int>::iterator vc;
202 for (vc =
Tval.begin(); vc !=
Tval.end() && (*vc) != 1; ++vc)
207 if (vc ==
Tval.end())
220 std::vector<int>::const_iterator vc;
223 for (vc =
Tval.begin(); vc !=
Tval.end(); ++vc) {
239 std::vector<int>::const_reverse_iterator vc;
240 for (vc =
Tval.rbegin(); vc !=
Tval.rend(); ++vc) {
242 out += ((*vc) == 1) ? 1 : 0;
247void BnId::mapState(
const std::vector<int> &Index, std::map<int, int> &Base)
const
254 std::vector<int>::const_iterator vc;
256 for (vc = Index.begin(); vc != Index.end(); ++vc, ++i)
257 Base[*vc] = (Tval[i] == 1) ? 1 : 0;
275 return std::pair<int, BnId>(-1,
BnId());
278 if (Znum != A.Znum || (Tnum - A.Tnum) * (Tnum - A.Tnum) > 1)
279 return std::pair<int, BnId>(-1,
BnId());
283 return std::pair<int, BnId>(0,
BnId());
286 auto avc = A.Tval.cbegin();
287 std::vector<int>::const_iterator chpt;
288 for (
auto tvc = Tval.cbegin(); tvc != Tval.cend(); ++tvc, ++avc) {
289 if ((*avc * *tvc) < 0)
292 return std::pair<int, BnId>(0,
BnId());
296 }
else if (*avc != *tvc)
297 return std::pair<int, BnId>(0,
BnId());
303 PIout.
Tval[(chpt - Tval.begin())] = 0;
305 return std::pair<int, BnId>(1, PIout);
308 return std::pair<int, BnId>(0,
BnId());
318 using std::placeholders::_1;
319 transform(
Tval.begin(),
Tval.end(),
Tval.begin(), std::bind(std::multiplies<int>(), _1, -1));
331 std::vector<int>::const_reverse_iterator vc;
332 std::ostringstream cx;
333 for (vc =
Tval.rbegin(); vc !=
Tval.rend(); ++vc) {
341 cx <<
"(" <<
Tnum <<
":" <<
Znum <<
")";
342 return Out + cx.str();
int intValue() const
Integer from binary expression.
void write(std::ostream &) const
writes the value to a stream
size_t size
number of variables
bool operator>(const BnId &) const
operator> for tri-state object
void mapState(const std::vector< int > &, std::map< int, int > &) const
Sets the components within base with true/false.
std::string display() const
Displays the value as a string.
void setCounters()
Calculates Tnum and Znum.
bool operator==(const BnId &) const
Equals operator for tri-state object.
bool operator<(const BnId &) const
operator> for tri-state object
std::pair< int, BnId > makeCombination(const BnId &) const
Find if A and this can be differ by one 1/-1 bit and make a 0 value for that bit.
void reverse()
Swap -1 to 1 adn leaver the zeros.
int Znum
Zero number (0 in Tval)
int operator++()
addition operator (returns !carry flag)
BnId()
Standard Constructor.
int equivalent(const BnId &) const
Equal but - is assume to be ok.
int operator--()
subtraction operator (returns !carry flag)
int operator[](int const) const
Access operator.
int Tnum
True number (1 in Tval)
std::vector< int > Tval
Truth values.
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.