[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.5 Weight

Term orderings introduced in the previous section can be generalized by setting a weight for each variable.

[0] dp_td(<<1,1,1>>);
[1] dp_set_weight([1,2,3])$
[2] dp_td(<<1,1,1>>);

By default, the total degree of a monomial is equal to the sum of all exponents. This means that the weight for each variable is set to 1. In this example, the weights for the first, the second and the third variable are set to 1, 2 and 3 respectively. Therefore the total degree of <<1,1,1>> under this weight, which is called the weight of the monomial, is 1*1+1*2+1*3=6. By setting weights, different term orderings can be set under a type of term ordeing. In some case a polynomial can be made weighted homogeneous by setting an appropriate weight.

A list of weights for all variables is called a weight vector. A weight vector is called a sugar weight vector if its elements are all positive and it is used for computing a weighted total degree of a monomial, because such a weight is used instead of total degree in sugar strategy. On the other hand, a weight vector whose elements are not necessarily positive cannot be set as a sugar weight, but it is useful for generalizing term order. In fact, such a weight vector already appeared in a matrix order. That is, each row of a matrix defining a term order is regarded as a weight vector. A block order is also considered as a refinement of comparison by weight vectors. It compares two terms by using a weight vector whose elements corresponding to variables in a block is 1 and 0 otherwise, then it applies a tie breaker.

A weight vector can be set by using dp_set_weight(). However it is more preferable if a weight vector can be set together with other parapmeters such as a type of term ordering and a variable order. This is realized as follows.

[64] B=[x+y+z-6,x*y+y*z+z*x-11,x*y*z-6]$
[65] dp_gr_main(B|v=[x,y,z],sugarweight=[3,2,1],order=0);
[66] dp_gr_main(B|v=[y,z,x],order=[[1,1,0],[0,1,0],[0,0,1]]);
[67] dp_gr_main(B|v=[y,z,x],order=[[x,1,y,2,z,3]]);

In each example, a term ordering is specified as options. In the first example, a variable order, a sugar weight vector and a type of term ordering are specified by options v, sugarweight and order respectively. In the second example, an option order is used to set a matrix ordering. That is, the specified weight vectors are used from left to right for comparing terms. The third example shows a variant of specifying a weight vector, where each component of a weight vector is specified variable by variable, and unspecified components are set to zero. In this example, a term order is not determined only by the specified weight vector. In such a case a tie breaker by the graded reverse lexicographic ordering is set automatically. This type of a term ordering specification can be applied only to builtin functions such as dp_gr_main(), dp_gr_mod_main(), not to user defined functions such as gr().

[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on December 1, 2023 using texi2html 5.0.