7 #ifndef CT_RXNPATH_GROUP
8 #define CT_RXNPATH_GROUP
24 Group() : m_sign(-999) { }
25 Group(
size_t n) : m_sign(0) {
28 Group(
const std::vector<int>& elnumbers) :
29 m_comp(elnumbers), m_sign(0) {
32 Group(
const std::vector<size_t>& elnumbers) :
33 m_comp(elnumbers.size()), m_sign(0) {
34 for (
size_t i = 0; i < elnumbers.size(); i++) {
35 m_comp[i] = int(elnumbers[i]);
40 m_comp(g.m_comp), m_sign(g.m_sign) { }
54 verifyInputs(*
this, other);
55 for (
size_t m = 0; m < m_comp.size(); m++) {
56 m_comp[m] -= other.m_comp[m];
60 void operator+=(
const Group& other) {
61 verifyInputs(*
this, other);
62 for (
size_t m = 0; m < m_comp.size(); m++) {
63 m_comp[m] += other.m_comp[m];
67 void operator*=(
int a) {
68 for (
size_t m = 0; m < m_comp.size(); m++) {
73 bool operator==(
const Group& other)
const {
74 verifyInputs(*
this, other);
75 for (
size_t m = 0; m < m_comp.size(); m++) {
76 if (m_comp[m] != other.m_comp[m]) {
82 friend Group operator-(
const Group& g1,
const Group& g2) {
88 friend Group operator+(
const Group& g1,
const Group& g2) {
94 friend void verifyInputs(
const Group& g1,
const Group& g2) {
110 return (m_sign != -999);
112 bool operator!()
const {
113 return (m_sign == -999);
118 size_t size()
const {
119 return m_comp.size();
125 for (
size_t m = 0; m < m_comp.size(); m++) {
126 sum += std::abs(m_comp[m]);
132 if (m_comp.empty()) {
138 std::ostream& fmt(std::ostream& s,
const std::vector<std::string>& esymbols)
const;
140 friend std::ostream& operator<<(std::ostream& s,
144 std::vector<int> m_comp;