diff --git a/README.md b/README.md index e5bc88b4..99308f66 100644 --- a/README.md +++ b/README.md @@ -97,4 +97,5 @@ Please refer bitsofcotton/p8 for this. 2024/04/23 add predC, predCbond command. 2024/05/29 cleanC, cleanc change. 2024/06/07 fix comment on test.py. +2024/06/09 compat with latest ddpmopt. diff --git a/lieonn.hh b/lieonn.hh index f4f56b85..ae582f11 100644 --- a/lieonn.hh +++ b/lieonn.hh @@ -2733,7 +2733,8 @@ template static inline pair, T> makeProgramInvarian template static inline T revertProgramInvariant(const pair& in, const bool& on01 = false) { const auto r0(in.first * in.second); - const auto r(T(int(0)) < r0 ? r0 - floor(r0) : ceil(- r0) + r0); + const auto r1(T(int(0)) < r0 ? r0 - floor(r0) : ceil(- r0) + r0); + const auto r(T(int(0)) == r1 ? T(int(1)) : r1); return on01 ? r : - tan(max(- T(int(1)) + sqrt(SimpleMatrix().epsilon()), min( T(int(1)) - sqrt(SimpleMatrix().epsilon()), @@ -3911,7 +3912,7 @@ template static inline bool loadstub(ifstream& input, const int& nm continue; } else if(mode) { mode = false; - datas[k](j, i) = T(work) / T(nmax); + datas[k](j, i) = T(work + 1) / (T(nmax) + T(int(1))); work = 0; if(++ k >= ncolor) { if(++ i >= datas[0].cols()) { @@ -3997,10 +3998,10 @@ template bool savep2or3(const char* filename, const vector pair > >, vector pair > >, vector > > > predMat(const vector > >& in0, const int& skip = 1, const int& cj = 11) { assert(0 < skip && in0.size() / skip && in0[0].size() && in0[0][0].rows() && in0[0][0].cols()); - const int ccj(ceil(sqrt(T(cj)))); + const auto ccj(int(ceil(sqrt(T(cj)))) | int(1)); assert(0 < ccj); if(ccj * ccj * 19683 < in0[0].size() * in0[0][0].rows() * in0[0][0].cols()) cerr << "predMat : elements larger than 19683, exceeds function entropy." << endl; @@ -4316,6 +4317,7 @@ template pair >, vector