Ejemplo n.º 1
0
static void test_buffer(bvarith_buffer_t *b) {
  bvmlist_t *m;

  printf("Buffer %p: ", b);
  print_bvarith_buffer(stdout, b);
  printf("\n");

  test_buffer_pred("is_zero", b, bvarith_buffer_is_zero);
  test_buffer_pred("is_constant", b, bvarith_buffer_is_constant);
  printf("  size: %"PRIu32"\n", bvarith_buffer_size(b));
  printf("  bitsize: %"PRIu32"\n", bvarith_buffer_bitsize(b));
  printf("  width: %"PRIu32"\n", bvarith_buffer_width(b));
  printf("  degree: %"PRIu32"\n", bvarith_buffer_degree(b));
  if (! bvarith_buffer_is_zero(b)) {
    printf("  main term: ");
    print_pprod0(stdout, bvarith_buffer_main_term(b));
    printf("\n");
    m = bvarith_buffer_main_mono(b);
    printf("  main monomial: ");
    bvconst_print(stdout, m->coeff, b->bitsize);
    printf(" * ");
    print_pprod0(stdout, m->prod);
    printf("\n");
  }

  printf("---\n");
}
Ejemplo n.º 2
0
static void test_buffer(rba_buffer_t *b) {
  int32_t x;
  mono_t *m;

  printf("Buffer %p: ", b);
  print_rba_buffer(stdout, b);
  printf("\n");

  test_buffer_pred("is_zero", b, rba_buffer_is_zero);
  test_buffer_pred("is_constant", b, rba_buffer_is_constant);
  test_buffer_pred("is_nonzero", b, rba_buffer_is_nonzero);
  test_buffer_pred("is_pos", b, rba_buffer_is_pos);
  test_buffer_pred("is_neg", b, rba_buffer_is_neg);
  test_buffer_pred("is_nonneg", b, rba_buffer_is_nonneg);
  test_buffer_pred("is_nonpos", b, rba_buffer_is_nonpos);

  printf("  size: %"PRIu32"\n", rba_buffer_num_terms(b));
  printf("  degree: %"PRIu32"\n", rba_buffer_degree(b));
  if (! rba_buffer_is_zero(b)) {
    printf("  main term: ");
    print_pprod0(stdout, rba_buffer_main_term(b));
    printf("\n");
    m = rba_buffer_main_mono(b);
    printf("  main monomial: ");
    q_print(stdout, &m->coeff);
    printf(" * ");
    print_pprod0(stdout, m->prod);
    printf("\n");
  }

  for (x=0; x<5; x++) {
    printf("  degree in x_%"PRId32": %"PRIu32"\n",
	   x, rba_buffer_var_degree(b, x));
  }
  printf("---\n");
}