Commit 2420015b authored by Charles Bouillaguet's avatar Charles Bouillaguet
Browse files

do not count empty polynomials

parent 7994bbe1
......@@ -2,6 +2,12 @@
This code is in the public domain. Several algorithms are implemented.
These programs are distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
They are not garanteed to always produce CORRECT RESULTS.
Exhaustive search is available elsewhere, in the [libfes-lite](https://gitlab.lip6.fr/almasty/libfes-lite) library.
......@@ -22,7 +28,6 @@ Example:
./monica_vector --inner-hybridation 7 < examples/random_40_quad.in
```
WARNING: this program has a bug ; it may incorrectly report that there are no solutions.
# Moebius
......
......@@ -98,6 +98,18 @@ void store_monomial(void *opaque, int line, int column, int degree, const int *v
void store_polynomial(void *opaque, int line)
{
// detect empty polynomials
bool nz = 0;
struct poly_t *p = &poly[m];
nz |= p->c;
for (int i = 0; i < 64; i++)
nz |= p->l[i];
for (int i = 0; i < 63; i++)
for (int j = 0; j < 64; j++)
nz |= p->q[i][j];
if (!nz)
return;
m += 1;
if (m == capacity) {
capacity = 1 + 2 * capacity;
......@@ -454,8 +466,6 @@ bool candidate_solution(const struct poly_t *p, int m, int n, u64 x) {
int main(int argc, char **argv)
{
printf("WARNING: this program has a bug ; it may incorrectly report that there are no solutions.\n");
/* parse command-line options */
int v = -1;
int max_excess = 4;
......
......@@ -170,6 +170,18 @@ void store_monomial(void *opaque, int line, int column, int degree, const int *v
void store_polynomial(void *opaque, int line)
{
// detect empty polynomials
bool nz = 0;
struct poly_t *p = &poly[m];
nz |= p->c;
for (int i = 0; i < 64; i++)
nz |= p->l[i];
for (int i = 0; i < 63; i++)
for (int j = 0; j < 64; j++)
nz |= p->q[i][j];
if (!nz)
return;
m += 1;
if (m == capacity) {
capacity = 1 + 2 * capacity;
......@@ -594,8 +606,6 @@ static void process_candidates(int v, u64 y, vector consistent, vector defect, c
int main(int argc, char **argv)
{
printf("WARNING: this program has a bug ; it may incorrectly report that there are no solutions.\n");
/* parse command-line options */
struct option longopts[3] = {
{"inner-hybridation", required_argument, NULL, 'v'},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment