void print_polynomial(FILE *OUT, polynomial *F, int numFuncs) /***************************************************************\ * USAGE: user-friendly printing of polynomial F to a file * \***************************************************************/ { int i, rV, somethingPrinted = 0, numTerms = F->numTerms, numVars = F->numVariables; for (i = 0; i < numTerms; i++) { // print coefficient rV = print_coeff(OUT, F->coeff[i], somethingPrinted); if (rV) { // print monomial print_monomial(OUT, F->exponents[i], numVars, numFuncs, rV, somethingPrinted); // something has been printed somethingPrinted = 1; } } // make sure something is printed if (!somethingPrinted) fprintf(OUT, "0"); return; }
/* * Print monomial array a * - n = number of monomials */ static void print_polynomial(monomial_t *a, uint32_t n) { uint32_t i; if (n == 0) { printf("0"); } else { for (i=0; i<n; i++) { print_monomial(a[i].var, &a[i].coeff, i == 0); } } }
// print subtree rooted at x static void print_rba_tree(FILE *f, rba_buffer_t *b, uint32_t x, bool first) { uint32_t i, j; if (x != 0) { i = b->child[x][0]; j = b->child[x][1]; print_rba_tree(f, b, i, first); first &= (i == 0); print_monomial(f, &b->mono[x].coeff, b->mono[x].prod, first); print_rba_tree(f, b, j, false); } }