monomial.h File Reference

Interface for monomials. More...

#include <inttypes.h>

Go to the source code of this file.

Defines

#define _N_   2
#define MON_BITS_PER_EXP   (64/(_N_+1))
#define MON_BITMASK_BLOCK   ((monomial_t) ((((monomial_t)1) << MON_BITS_PER_EXP) - ((monomial_t)1)))
#define MON_BITMASK_ALL   (64 % (_N_ + 1) ? ((monomial_t) ((((monomial_t)1) << ((_N_ + 1) * MON_BITS_PER_EXP)) - ((monomial_t)1))) : 0xFFFFFFFFFFFFFFFFULL)
#define MON_VARS   "XYZ"
#define MON_INIT(x)   ((x) = 0)
#define MON_CLEAR(x)
#define MON_SET(x, y)   ((x) = (y))
#define MON_SWAP(x, y)   { monomial_t _t_ = (x); (x) = (y); (y) = _t_; }
#define MON_ONE(x)   ((x) = 0)
#define MON_GET_EXP(x, i)   ((exponent_t) (((x) >> ((i) * MON_BITS_PER_EXP)) & MON_BITMASK_BLOCK))
#define MON_SET_EXP(x, i, e)   ((x) = (((x) & (MON_BITMASK_ALL - (MON_BITMASK_BLOCK << ((i) * MON_BITS_PER_EXP)))) | (((monomial_t)(e)) << ((i) * MON_BITS_PER_EXP))))
#define MON_INC_EXP(x, i, e)   ((x) = ((x) + (((monomial_t)(e)) << ((i) * MON_BITS_PER_EXP))))
#define MON_DEC_EXP(x, i, e)   ((x) = ((x) - (((monomial_t)(e)) << ((i) * MON_BITS_PER_EXP))))
#define MON_CMP_INVLEX(x, y)   (((x) < (y)) ? -1 : ((x) > (y) ? 1 : 0))
#define MON_IS_ONE(x)   ((x) == 0)
#define MON_MUL(x, y, z)   ((x) = (y) + (z))
#define MON_DIV(x, y, z)   ((x) = (y) - (z))

Typedefs

typedef uint64_t monomial_t
typedef uint32_t exponent_t

Functions

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_tmon_generate_by_degree (uint32_t *len, const uint8_t n, const uint32_t d)


Detailed Description

Interface for monomials.

Author:
Sebastian Pancratz
Date:
Oct--Nov 2009

Define Documentation

#define _N_   2

Set up for monomial in _N_ + 1 variables. We only support values of _N_ in the range 1,...,7.

#define MON_BITMASK_ALL   (64 % (_N_ + 1) ? ((monomial_t) ((((monomial_t)1) << ((_N_ + 1) * MON_BITS_PER_EXP)) - ((monomial_t)1))) : 0xFFFFFFFFFFFFFFFFULL)

Bitmask with all 1s except for the leading 64 - (_N_ + 1) * (64/(_N_ + 1)) bits, that is, apart from the leading 64 % (_N_ + 1) bits.

#define MON_BITMASK_BLOCK   ((monomial_t) ((((monomial_t)1) << MON_BITS_PER_EXP) - ((monomial_t)1)))

Bitmask with all 0s apart from the MON_BITS_PER_EXP least significant bits.

#define MON_BITS_PER_EXP   (64/(_N_+1))

Number of bits per exponent in the word used for the monomial.

#define MON_VARS   "XYZ"

String literal of length _N_ + 1 with default variable names.


Typedef Documentation

Data type for an exponent.

Data type for a monomial.

We represent a monomial as a 64-bit word. More precisely, we store the monomial $(i_0, \dotsc, i_n)$ using MON_BITS_PER_EXP bits per exponent, where the least significant block is used for $i_0$. If $n+1$ does not divide 64 exactly then the $64 \bmod (n+1)$ most significant bits are always 0.


Generated on Sat Nov 14 23:24:27 2009 for MONF by  doxygen 1.5.6