Skip to content

Commit

Permalink
correct sign of Sigma
Browse files Browse the repository at this point in the history
  • Loading branch information
TentativeConvert committed Feb 15, 2018
1 parent 0314205 commit fcbed90
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
22 changes: 11 additions & 11 deletions esch_generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SpaceTupleList::SpaceTupleList(const INT_R& R)
INT_P k1;
INT_P k2;
INT_R unreduced_s() const { return -(k1*k2*(n+d)); };
int_least8_t M1() const { return (int_least8_t)signed_mod(-k1-k2+n+d, 3); };
int_least8_t SIGMA() const { return (int_least8_t)signed_mod(+k1+k2-n-d, 3); };
//M2//int_least8_t M2() const { return (int_least8_t)absolute_mod(k1 + k2 -n-d + k1*k2 -k1*n-k1*d -k2*n-k2*d, 2); };
};
deque< deque< struct tinySpace > > all_spaces((INT_R)((R+1)/2));
Expand Down Expand Up @@ -122,24 +122,24 @@ SpaceTupleList::SpaceTupleList(const INT_R& R)
for(INT_R hmr = 0; hmr < (R+1)/2; ++hmr){ //hmr = "half minus r" (abgerundet)
feedback.update((std::size_t)hmr);
//------------------------------------------------
// Sort spaces in all_spaces[hmr] by their invariants |s| and |M1|.
// Sort spaces in all_spaces[hmr] by their invariants |s| and |SIGMA|.
// To speed up sorting, turn the deque all_spaces[hmr] into a list r_spaces.
struct miniSpace {
// slightly higher memory usage than tinySpace: two more variables (s & M1)
// slightly higher memory usage than tinySpace: two more variables (s & SIGMA)
INT_P d;
INT_P n;
INT_P k1;
INT_P k2;
INT_R s;
int_least8_t M1; // only values are +1, 0, -1
int_least8_t SIGMA; // only values are +1, 0, -1
//M2//int_least8_t M2; // only values are 1, 0
bool operator<(const miniSpace& otherspace) const {
if (abs(s) > abs(otherspace.s)) return false;
if (abs(s) < abs(otherspace.s)) return true;
if (abs(M1) > abs(otherspace.M1)) return false;
if (abs(M1) < abs(otherspace.M1)) return true;
if (sign(s)*sign(M1) > sign(otherspace.s)*sign(otherspace.M1)) return false;
if (sign(s)*sign(M1) < sign(otherspace.s)*sign(otherspace.M1)) return true;
if (abs(SIGMA) > abs(otherspace.SIGMA)) return false;
if (abs(SIGMA) < abs(otherspace.SIGMA)) return true;
if (sign(s)*sign(SIGMA) > sign(otherspace.s)*sign(otherspace.SIGMA)) return false;
if (sign(s)*sign(SIGMA) < sign(otherspace.s)*sign(otherspace.SIGMA)) return true;
//M2//if (M2 > otherspace.M2) return false;
//M2//if (M2 < otherspace.M2) return true;
return false;
Expand All @@ -154,7 +154,7 @@ SpaceTupleList::SpaceTupleList(const INT_R& R)
r_spaces[i].k1 = E.k1;
r_spaces[i].k2 = E.k2;
r_spaces[i].s = signed_mod(E.unreduced_s(),mr);
r_spaces[i].M1 = E.M1();
r_spaces[i].SIGMA = E.SIGMA();
//M2//r_spaces[i].M2 = E.M2();
}
std::sort(r_spaces.begin(),r_spaces.end());
Expand All @@ -165,8 +165,8 @@ SpaceTupleList::SpaceTupleList(const INT_R& R)
std::size_t i2 = i1+1;
while (i2 < r_spaces.size()
&& abs(r_spaces[i1].s) == abs(r_spaces[i2].s)
&& abs(r_spaces[i1].M1) == abs(r_spaces[i2].M1)
&& sign(r_spaces[i1].s)*sign(r_spaces[i1].M1) == sign(r_spaces[i2].s)*sign(r_spaces[i2].M1)
&& abs(r_spaces[i1].SIGMA) == abs(r_spaces[i2].SIGMA)
&& sign(r_spaces[i1].s)*sign(r_spaces[i1].SIGMA) == sign(r_spaces[i2].s)*sign(r_spaces[i2].SIGMA)
//M2//&& r_spaces[i1].M2 == r_spaces[i2].M2
)
++i2;
Expand Down
28 changes: 14 additions & 14 deletions esch_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const boost::rational<INT_KS> Space::KS_UNCOMPUTABLE = boost::rational<INT_KS>(1

void Space::print(FILE* file) const
{
//M2//fprintf(file, " [%4ld,%4ld,%4ld, %4ld,%4ld,%4ld] -> r = %5ld, s = %7ld, m1 = %2d, m2 = %d, p1 = %5ld",
//M2// (long)k_[0],(long)k_[1],(long)k_[2],(long)l_[0],(long)l_[1],(long)l_[2],(long)(abs(r_)), (long)s_, (int)(m1_), (int)(m2_), (long)p1_);
//M2//fprintf(file, " [%4ld,%4ld,%4ld, %4ld,%4ld,%4ld] -> r = %5ld, s = %7ld, Sigma = %2d, m2 = %d, p1 = %5ld",
//M2// (long)k_[0],(long)k_[1],(long)k_[2],(long)l_[0],(long)l_[1],(long)l_[2],(long)(abs(r_)), (long)s_, (int)(Sigma_), (int)(m2_), (long)p1_);
fprintf(file, " [%4ld,%4ld,%4ld, %4ld,%4ld,%4ld] -> r = %5ld, s = %7ld, Sigma = %2d, p1 = %5ld", //M2//
(long)k_[0],(long)k_[1],(long)k_[2],(long)l_[0],(long)l_[1],(long)l_[2],(long)(abs(r_)), (long)s_, (int)(m1_), (long)p1_); //M2//
(long)k_[0],(long)k_[1],(long)k_[2],(long)l_[0],(long)l_[1],(long)l_[2],(long)(abs(r_)), (long)s_, (int)(Sigma_), (long)p1_); //M2//
if (s2_ == KS_UNKNOWN)
fprintf(file, "\n");
else if (s2_ == KS_UNCOMPUTABLE)
Expand All @@ -34,8 +34,8 @@ void Space::print(void) const
{
printf("\nInvariants of the Eschenburg space with parameters [%ld,%ld,%ld, %ld,%ld,%ld]:\n",
(long)k_[0],(long)k_[1],(long)k_[2],(long)l_[0],(long)l_[1],(long)l_[2]);
//M2//printf(" r = %ld, s = %ld, m1 = %d, m2 = %d\n p1 = %ld\n",(long)(abs(r_)), (long)s_, (int)(m1_), (int)(m2_), (long)p1_);
printf(" r = %ld, s = %ld, Sigma = %d \n p1 = %ld\n",(long)(abs(r_)), (long)s_, (int)(m1_), (long)p1_); //M2//
//M2//printf(" r = %ld, s = %ld, Sigma = %d, m2 = %d\n p1 = %ld\n",(long)(abs(r_)), (long)s_, (int)(Sigma_), (int)(m2_), (long)p1_);
printf(" r = %ld, s = %ld, Sigma = %d \n p1 = %ld\n",(long)(abs(r_)), (long)s_, (int)(Sigma_), (long)p1_); //M2//
if (s2_ == KS_UNCOMPUTABLE)
printf("! Condition C is not satisfied !\n");
else
Expand Down Expand Up @@ -65,7 +65,7 @@ Space::Space(array<INT_P,3> kkk, array<INT_P,3> lll){
INT_R sigma3_l = (INT_R)l_[0]*(INT_R)l_[1]*(INT_R)l_[2];
r_ = sigma2_k - sigma2_l;
s_ = signed_mod(sigma3_k-sigma3_l, abs(r_))*sign(r_);
m1_ = signed_mod(-sigma1_l,3);
Sigma_ = signed_mod(sigma1_l,3);
//M2//m2_ = absolute_mod(sigma1_l + sigma2_l,2);
p1_ = absolute_mod(2*sigma1_k*sigma1_k - 6*sigma2_k, abs(r_));
good_col_or_row = GOOD_CoR_UNKNOWN;
Expand Down Expand Up @@ -251,12 +251,12 @@ rational<INT_KS> Space::lens_s2(INT_P p, array<INT_P,4> param)
//M2// if (abs(E1.r_ ) < abs(E2.r_ )) return comp::SMALLER;
//M2// if (abs(E1.s_ ) > abs(E2.s_ )) return comp::GREATER;
//M2// if (abs(E1.s_ ) < abs(E2.s_ )) return comp::SMALLER;
//M2// if (abs(E1.m1_) > abs(E2.m1_)) return comp::GREATER;
//M2// if (abs(E1.m1_) < abs(E2.m1_)) return comp::SMALLER;
//M2// if (abs(E1.Sigma_) > abs(E2.Sigma_)) return comp::GREATER;
//M2// if (abs(E1.Sigma_) < abs(E2.Sigma_)) return comp::SMALLER;
//M2// if ( E1.m2_ > E2.m2_ ) return comp::GREATER;
//M2// if ( E1.m2_ < E2.m2_ ) return comp::SMALLER;
//M2// if (sign(E1.m1_)*sign(E1.s_) > sign(E2.m1_)*sign(E2.s_)) return comp::GREATER;
//M2// if (sign(E1.m1_)*sign(E1.s_) < sign(E2.m1_)*sign(E2.s_)) return comp::SMALLER;
//M2// if (sign(E1.Sigma_)*sign(E1.s_) > sign(E2.Sigma_)*sign(E2.s_)) return comp::GREATER;
//M2// if (sign(E1.Sigma_)*sign(E1.s_) < sign(E2.Sigma_)*sign(E2.s_)) return comp::SMALLER;
//M2// return comp::EQUAL;
//M2//}

Expand All @@ -267,10 +267,10 @@ Space::comp Space::compareHomotopyType(const Space& E1, const Space& E2)
if (abs(E1.r_) < abs(E2.r_)) return comp::SMALLER;
if (abs(E1.s_) > abs(E2.s_)) return comp::GREATER;
if (abs(E1.s_) < abs(E2.s_)) return comp::SMALLER;
if (abs(E1.m1_) > abs(E2.m1_)) return comp::GREATER; //M2//
if (abs(E1.m1_) < abs(E2.m1_)) return comp::SMALLER; //M2//
if (sign(E1.m1_)*sign(E1.s_) > sign(E2.m1_)*sign(E2.s_)) return comp::GREATER; //M2//
if (sign(E1.m1_)*sign(E1.s_) < sign(E2.m1_)*sign(E2.s_)) return comp::SMALLER; //M2//
if (abs(E1.Sigma_) > abs(E2.Sigma_)) return comp::GREATER; //M2//
if (abs(E1.Sigma_) < abs(E2.Sigma_)) return comp::SMALLER; //M2//
if (sign(E1.Sigma_)*sign(E1.s_) > sign(E2.Sigma_)*sign(E2.s_)) return comp::GREATER; //M2//
if (sign(E1.Sigma_)*sign(E1.s_) < sign(E2.Sigma_)*sign(E2.s_)) return comp::SMALLER; //M2//
// If both KS-invariants are unkown, return MAYBE_EQUAL;
// otherwise, the unknown KS-invariant is MAYBE_GREATER
// than the known one.
Expand Down
12 changes: 6 additions & 6 deletions esch_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class Space {
private:
std::array<INT_P,3> k_;
std::array<INT_P,3> l_;
INT_R r_; // = r(k,l); it can be positive or negative.
// (in [CEZ07], "r := |r(k,l)|")
INT_R s_; // = s(k,l) modulo |r(k,l)|
int_least8_t m1_; // = -l1-l2-l3 mod 3
INT_R r_; // = r(k,l); it can be positive or negative.
// (in [CEZ07], "r := |r(k,l)|")
INT_R s_; // = s(k,l) modulo |r(k,l)|
int_least8_t Sigma_; // = -l1-l2-l3 mod 3
//M2//int_least8_t m2_; // = l1 + l2 + l3 + l1l2 + l1l3 + l2l3 mod 2
INT_R p1_; // = p_1(k,l) modulo |r(k,l)|
INT_R p1_; // = p_1(k,l) modulo |r(k,l)|
boost::rational<INT_KS> s2_;

// KS-invariants s2 and s22 take values in interval (-1/2,1/2]
Expand Down Expand Up @@ -46,7 +46,7 @@ class Space {
const std::array<INT_P,3>& l() const { return k_; }
const INT_R& r() const { return r_; }
const INT_R& s() const { return s_; }
const int_least8_t m1() const { return m1_; }
const int_least8_t Sigma() const { return Sigma_; }
//M2//const int_least8_t m2() const { return m2_; }
const INT_R& p1() const { return p1_; }
const boost::rational<INT_KS>& s2() const {return s2_; }
Expand Down

0 comments on commit fcbed90

Please sign in to comment.