monomial.h File Reference

Interface for monomials. More...

#include <inttypes.h>

Go to the source code of this file.

Defines

#define MON_BITS_PER_EXP   8
#define MON_BITMASK_BLOCK   0x00000000000000FFULL
#define MON_BITMASK_ALL   0xFFFFFFFFFFFFFFFFULL
#define MON_VARS(n)   (n == 1 ? "XY" : n == 2 ? "XYZ" : n == 3 ? "WXYZ" : n == 4 ? "VWXYZ" : n == 5 ? "UVWXYZ" : n == 6 ? "TUVWXYZ" : "STUVWXYZ")
#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 uint8_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)
monomial_tmon_generate_by_degree_invlex (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 MON_BITMASK_ALL   0xFFFFFFFFFFFFFFFFULL

Bitmask with all 1s.

#define MON_BITMASK_BLOCK   0x00000000000000FFULL

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

#define MON_BITS_PER_EXP   8

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

#define MON_VARS (  )     (n == 1 ? "XY" : n == 2 ? "XYZ" : n == 3 ? "WXYZ" : n == 4 ? "VWXYZ" : n == 5 ? "UVWXYZ" : n == 6 ? "TUVWXYZ" : "STUVWXYZ")

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


Typedef Documentation

Data type for an exponent.

We represent an exponent as an 8-bit word. This means that we only support monomials in the range $[0, 256)$.

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:59 2009 for MONV by  doxygen 1.5.6