Skip to content

Commit bd78c0b

Browse files
committed
Use modern boolean operators throughout
1 parent b4eb603 commit bd78c0b

File tree

5 files changed

+65
-65
lines changed

5 files changed

+65
-65
lines changed

iB4e/BBPolytope.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ namespace iB4e
101101
LVector new_test_vector;
102102

103103
// If either of c or -c yields a point that increases the dimension of the polytope, add it
104-
if (!done) {
104+
if (not done) {
105105
FPoint result = this->vertex_oracle(c);
106-
if (this->number_of_vertices() == 0 || this->is_dimension_jump(result)) {
106+
if (this->number_of_vertices() == 0 or this->is_dimension_jump(result)) {
107107
this->insert(result);
108108
new_test_vector = LVector(result.cartesian_begin(), result.cartesian_end()) - first_result_lv;
109109
done = true;
110110
}
111111
}
112112

113-
if (!done) {
113+
if (not done) {
114114
FPoint result = vertex_oracle(-c);
115115
if (this->is_dimension_jump(result)) {
116116
this->insert(result);
@@ -120,7 +120,7 @@ namespace iB4e
120120
}
121121

122122
// Otherwise, add c as a test vector
123-
if (!done) {
123+
if (not done) {
124124
new_test_vector = x;
125125
done = true;
126126
}
@@ -141,14 +141,14 @@ namespace iB4e
141141
// MAIN LOOP
142142
bool all_confirmed_so_far = false;
143143
int confirmed = 0;
144-
while (!all_confirmed_so_far) {
144+
while (not all_confirmed_so_far) {
145145
hook_perloop(confirmed);
146146

147147
all_confirmed_so_far = true;
148148

149149
// Attempt to confirm every facet
150-
for (Facet_iterator f = this->facets_begin(); f != this->facets_end() && all_confirmed_so_far ; f++) {
151-
if (!f->is_confirmed()) { // If the facet is not already confirmed, test it
150+
for (Facet_iterator f = this->facets_begin(); f != this->facets_end() and all_confirmed_so_far ; f++) {
151+
if (not f->is_confirmed()) { // If the facet is not already confirmed, test it
152152
Hyperplane hp = this->hyperplane_supporting(f);
153153
FVector innernormal = -hp.orthogonal_vector(); // CGAL returns the outer normal
154154
FPoint result = vertex_oracle(innernormal);

src/nntm-energy.cc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ namespace pmfe {
248248
// if inside==true, dangle i+1 instead of i-1
249249
Rational NNTM::Ed5(int i, int j, const RNASequence& seq, bool inside) const {
250250
// Input specification
251-
assert (i >= 0 && i < seq.len());
252-
assert (j >= 0 && j < seq.len());
251+
assert (i >= 0 and i < seq.len());
252+
assert (j >= 0 and j < seq.len());
253253

254254
Rational penalty = 0;
255255

@@ -272,8 +272,8 @@ namespace pmfe {
272272
// if inside==true, dangle j-1 instead of j+1
273273
Rational NNTM::Ed3(int i, int j, const RNASequence& seq, bool inside) const {
274274
// Input specification
275-
assert (i >= 0 && i < seq.len());
276-
assert (j >= 0 && j < seq.len());
275+
assert (i >= 0 and i < seq.len());
276+
assert (j >= 0 and j < seq.len());
277277

278278
Rational penalty = 0;
279279

@@ -330,9 +330,9 @@ namespace pmfe {
330330
Compute the energy of an internal loop between pairs (i, j) and (ip, jp)
331331
*/
332332
// Input specification
333-
assert (i >= 0 && i < seq.len());
334-
assert (j >= 0 && j < seq.len());
335-
assert (i < ip && ip < jp && jp < j);
333+
assert (i >= 0 and i < seq.len());
334+
assert (j >= 0 and j < seq.len());
335+
assert (i < ip and ip < jp and jp < j);
336336

337337
Rational energy = Rational::infinity();
338338

@@ -360,7 +360,7 @@ namespace pmfe {
360360
+ eLL(size)
361361
+ auPenalty(i, j, seq)
362362
+ auPenalty(ip, jp, seq);
363-
} else if (size <= 30 && size > 1) {
363+
} else if (size <= 30 and size > 1) {
364364
/* Does not depend upon i and j and ip and jp - Stacking Energies */
365365
energy = constants.bulge[size]
366366
+ auPenalty(i, j, seq)
@@ -376,7 +376,7 @@ namespace pmfe {
376376
/* Internal loop */
377377

378378
if (size > 30) {
379-
if (!((size1 == 1 || size2 == 1) && constants.gail)) { /* normal internal loop with size > 30*/
379+
if (not ((size1 == 1 or size2 == 1) and constants.gail)) { /* normal internal loop with size > 30*/
380380
energy = constants.tstki[seq.base(i)][seq.base(j)][seq.base(i + 1)][seq.base(j - 1)]
381381
+ constants.tstki[seq.base(jp)][seq.base(ip)][seq.base(jp + 1)][seq.base(ip - 1)] + constants.inter[30]
382382
+ eLL(size)
@@ -396,7 +396,7 @@ namespace pmfe {
396396
energy = constants.iloop21[seq.base(jp)][seq.base(ip)][seq.base(j - 1)][seq.base(i + 2)][seq.base(i + 1)][seq.base(j)][seq.base(i)];
397397
} else if (size == 2) { /* 1*1 internal loops */
398398
energy = constants.iloop11[seq.base(i)][seq.base(i + 1)][seq.base(ip)][seq.base(j)][seq.base(j - 1)][seq.base(jp)];
399-
} else if ((size1 == 1 or size2 == 1) && constants.gail) { /* gail = (Grossly Asymmetric Interior Loop Rule) (on/off <-> 1/0) */
399+
} else if ((size1 == 1 or size2 == 1) and constants.gail) { /* gail = (Grossly Asymmetric Interior Loop Rule) (on/off <-> 1/0) */
400400
energy = constants.tstki[seq.base(i)][seq.base(j)][BASE_A][BASE_A] + constants.tstki[seq.base(jp)][seq.base(ip)][BASE_A][BASE_A]
401401
+ constants.inter[size]
402402
+ penterm;
@@ -417,8 +417,8 @@ namespace pmfe {
417417
*/
418418

419419
// Input specification
420-
assert (i >= 0 && i < seq.len());
421-
assert (j >= 0 && j < seq.len());
420+
assert (i >= 0 and i < seq.len());
421+
assert (j >= 0 and j < seq.len());
422422
assert (i < j);
423423

424424
Rational energy = Rational::infinity();
@@ -431,7 +431,7 @@ namespace pmfe {
431431
energy = constants.hairpin[30] + eLL(size) + constants.tstkh[seq.base(i)][seq.base(j)][seq.base(i + 1)][seq.base(j - 1)]; /* size penalty + terminal mismatch stacking energy*/
432432
}
433433

434-
else if (size <= 30 && size > 4) {
434+
else if (size <= 30 and size > 4) {
435435
energy = constants.hairpin[size] + constants.tstkh[seq.base(i)][seq.base(j)][seq.base(i + 1)][seq.base(j - 1)]; /* size penalty + terminal mismatch stacking energy*/
436436
}
437437

@@ -455,7 +455,7 @@ namespace pmfe {
455455
energy += auPenalty(i, j, seq);
456456
}
457457

458-
else if (size < 3 && size != 0) {
458+
else if (size < 3 and size != 0) {
459459
/* no terminal mismatch */
460460
energy = constants.hairpin[size];
461461
} else if (size == 0)
@@ -464,16 +464,16 @@ namespace pmfe {
464464
/* GGG Bonus => GU closure preceded by GG */
465465
/* i-2 = i-1 = i = G, and j = U; i < j */
466466
if (i >= 2) {
467-
if (seq.base(i - 2) == BASE_G && seq.base(i - 1) == BASE_G && seq.base(i) == BASE_G
468-
&& seq.base(j) == BASE_U) {
467+
if (seq.base(i - 2) == BASE_G and seq.base(i - 1) == BASE_G and seq.base(i) == BASE_G
468+
and seq.base(j) == BASE_U) {
469469
energy += constants.gubonus;
470470
/* printf ("\n GGG bonus for i %d j %d ", i, j); */
471471
}
472472
}
473473

474474
/* Poly-C loop => How many C are needed for being a poly-C loop */
475475
Rational tlink = 1;
476-
for (int index = 1; (index <= size) && (tlink == 1); ++index) {
476+
for (int index = 1; (index <= size) and (tlink == 1); ++index) {
477477
if (seq.base(i + index) != BASE_C)
478478
tlink = 0;
479479
}
@@ -494,8 +494,8 @@ namespace pmfe {
494494
Compute the energy of a stack of pairs (i, j) and (i+1, j-1)
495495
*/
496496
// Input specification
497-
assert (i >= 0 && i < seq.len());
498-
assert (j >= 0 && j < seq.len());
497+
assert (i >= 0 and i < seq.len());
498+
assert (j >= 0 and j < seq.len());
499499
assert (i < j);
500500

501501
return constants.stack[seq.base(i)][seq.base(j)][seq.base(i+1)][seq.base(j-1)];
@@ -507,8 +507,8 @@ namespace pmfe {
507507
*/
508508

509509
// Input specification
510-
assert (i >= 0 && i < seq.len());
511-
assert (j >= 0 && j < seq.len());
510+
assert (i >= 0 and i < seq.len());
511+
assert (j >= 0 and j < seq.len());
512512
assert (i < j);
513513

514514
MinBox<Rational> vals;
@@ -527,7 +527,7 @@ namespace pmfe {
527527
}
528528

529529
for (int q = minq; q <= maxq; q++) {
530-
if (q - p > TURN && seq.can_pair(p, q)) {
530+
if (q - p > TURN and seq.can_pair(p, q)) {
531531
vals.insert(eL(i, j, p, q, seq) + seq.V[p][q]);
532532
}
533533
}

0 commit comments

Comments
 (0)