#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "monomial.h"
Defines | |
#define | _MON_EXP_LENGTH_(e) ((e) < 10 ? 1 : (e) < 100 ? 2 : (e) < 1000 ? 3 : (e) < 10000 ? 4 : (e) < 100000 ? 5 : (e) < 1000000 ? 6 : (e) < 10000000 ? 7 : (e) < 100000000 ? 8 : (e) < 1000000000 ? 9 : 10) |
Functions | |
uint32_t | _binom_ (uint32_t n, uint32_t k) |
uint32_t | mon_degree (monomial_t op) |
int32_t | mon_divides (monomial_t x, monomial_t y) |
char * | mon_to_string (monomial_t x, const uint8_t n) |
char * | mon_to_string_pretty (monomial_t x, const uint8_t n, const char *vars) |
monomial_t | mon_from_string (char *str) |
monomial_t * | mon_generate_by_degree (uint32_t *len, const uint8_t n, const uint32_t d) |
monomial_t * | mon_generate_by_degree_invlex (uint32_t *len, const uint8_t n, const uint32_t d) |
#define _MON_EXP_LENGTH_ | ( | e | ) | ((e) < 10 ? 1 : (e) < 100 ? 2 : (e) < 1000 ? 3 : (e) < 10000 ? 4 : (e) < 100000 ? 5 : (e) < 1000000 ? 6 : (e) < 10000000 ? 7 : (e) < 100000000 ? 8 : (e) < 1000000000 ? 9 : 10) |
Number of digits (in base 10) for the exponent e
.
uint32_t _binom_ | ( | uint32_t | n, | |
uint32_t | k | |||
) |
Returns the binomial coefficient .
Special cases are handled as follows. If , returns
. If
or
, returns
.