Ejemplo n.º 1
0
/*
 * Copy the content of buffer b into f
 */
static void set_normal_form(normal_form_t *f, poly_buffer_t *b) {
  monomial_t *mono;
  uint32_t i, n;

  n = poly_buffer_nterms(b);
  mono = poly_buffer_mono(b);

  assert(n <= f->size);
  for (i=0; i<n; i++) {
    f->mono[i].var = mono[i].var;
    q_set(&f->mono[i].coeff, &mono[i].coeff);
  }
  f->mono[i].var = max_idx; // end marker

  f->nterms = n;
  f->hash = hash_monarray(f->mono, n);
}
Ejemplo n.º 2
0
/*
 * Offset manager
 */
static void show_poly_buffer(poly_buffer_t *b) {
  monomial_t *mono;
  uint32_t i, n;
  bool first;

  n = poly_buffer_nterms(b);
  mono = poly_buffer_mono(b);
  if (n == 0) {
    printf("0");
  } else {
    first = true;
    for (i=0; i<n; i++) {
      print_mono("z", &mono[i].coeff, mono[i].var, first);
      first = false;
    }
  }
}
Ejemplo n.º 3
0
static bool equal_poly_buffers(poly_buffer_t *bx, poly_buffer_t *by) {
  return poly_buffer_nterms(bx) == poly_buffer_nterms(by) &&
    equal_monarrays(poly_buffer_mono(bx), poly_buffer_mono(by));
}