Commit 61ec0bb0 authored by Charles Bouillaguet's avatar Charles Bouillaguet
Browse files

better error reporting

parent e01c70fc
......@@ -365,8 +365,8 @@ void monomial_setup_list()
err(1, "cannot allocate monomial list");
for (int d = 0; d <= D; d++)
monomial_enumerate(d, &monomials[Nd[d]]);
test_grlex_order();
test_ranking();
// test_grlex_order();
// test_ranking();
log(1, " - Singling out bad monomials\n");
bad_renumbering = malloc(Nd[D + 1] * sizeof(*bad_renumbering));
......@@ -378,7 +378,7 @@ void monomial_setup_list()
nbad += bad;
}
log(2, " - %d bad monomials\n", nbad);
test_bad_monomials();
// test_bad_monomials();
log(1, " - Monomials setup: %.1fs\n", wtime() - start);
#ifdef ULTRAVERBOSE
......@@ -394,7 +394,8 @@ void monomial_setup_list()
void monomial_setup_multiplication()
{
log(0, "Building monomial multiplication table\n");
mul_table = malloc(Nd[3] * Nd[D - 1] * sizeof(*mul_table));
u64 size = ((u64) Nd[3]) * ((u64) Nd[D - 1]) * sizeof(*mul_table);
mul_table = malloc(size);
if (mul_table == NULL)
err(1, "cannot allocate monomial multiplication table");
for (int i = 0; i < Nd[3]; i++) {
......@@ -423,6 +424,7 @@ u64 *Up;
int *Uj;
int skipped;
mzd_t *M; /* dense matrix for degree D-2 multiples */
int valid_multipliers; /* number of monomial multipliers used of the final matrix */
void matrix_setup()
{
......@@ -516,6 +518,7 @@ int convert_input_poly(struct poly_t *p, int *row)
void macaulay_dense(int d)
{
valid_multipliers = Nd[d + 1];
if (d < 2)
return;
log(0, "Generating degree-%d (dense) Macaulay matrix \n", d);
......@@ -552,6 +555,7 @@ void macaulay_dense(int d)
if (j < n + 1)
errx(1, "New linear equation found! (decrease D)");
LM[j] = 1;
valid_multipliers -= 1;
}
}
......@@ -662,20 +666,21 @@ int main(int argc, char **argv)
log(1, " - %d total monomials of degree <= %d\n", Nd[D+1], D);
log(1, " - %d matrix columns\n", nbad);
int mac_rows = m * Nd[D - 1];
if (D >= 4)
mac_rows -= m * Nd[D - 3];
monomial_setup_multiplication();
macaulay_dense(D - 2);
int mac_rows = m * valid_multipliers;
char hnrows[10];
char hncols[10];
human_format(mac_rows, hnrows);
human_format(nbad, hncols);
log(1, " - Estimating sparse matrix: %s rows, %s columns\n", hnrows, hncols);
if (mac_rows < nbad)
errx(1, "matrix will have more columns than rows. Increase degree or reduce inner hybridation.");
log(1, " - Sparse matrix: %s rows, %s columns\n", hnrows, hncols);
if (mac_rows > nbad)
log(1, " - %d extra rows (OK)\n", mac_rows - nbad);
else
errx(1, "ERROR : more columns than rows (%d extra columns)", nbad - mac_rows);
monomial_setup_multiplication();
macaulay_dense(D - 2);
log(0, "Starting matrix production\n");
matrix_setup();
for (int d = 2; d <= D; d++) {
......@@ -713,12 +718,6 @@ int main(int argc, char **argv)
else
errx(1, " - %d empty columnss (KO)!\n", ncols - ntouched_cols);
if (nrows > ncols)
log(1, " - %d extra rows (OK)\n", nrows - ncols);
else
errx(1, "ERROR : more columns than rows (%d extra columns)", ncols - nrows);
if (out_filename) {
log(1, "saving...\n");
FILE *out_file = fopen(out_filename, "w");
......
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