Macaulay2 Engine
Loading...
Searching...
No Matches

◆ index_of_var()

int DPoly::index_of_var ( int level,
const TowerPolynomial f ) const

Definition at line 1456 of file dpoly.cpp.

1457{
1458 if (f == nullptr or level < 0 or f->deg >= 2) return -1;
1459 if (level == 0)
1460 {
1461 if (f->deg == 0) return -1;
1462 // At this point, degree is 1.
1463 if (f->arr.ints[0] == 0 and f->arr.ints[1] == 1)
1464 return 0;
1465 else
1466 return -1;
1467 }
1468 else
1469 {
1470 if (f->arr.polys[0] == nullptr and is_one(level - 1, f->arr.polys[1]))
1471 return level;
1472 if (f->deg == 1) return -1;
1473 return index_of_var(level - 1, f->arr.polys[0]);
1474 }
1475}
int index_of_var(int level, const TowerPolynomial f) const
Definition dpoly.cpp:1456
static bool is_one(int level, const TowerPolynomial f)
Definition dpoly.cpp:595

References index_of_var(), and is_one().

Referenced by index_of_var().