On an Algorithmic Optimization in Computation of

2 downloads 0 Views 55KB Size Report
monomials, and Id(F) denotes the ideal generated by the set F. For any finite set of monomials U ⊂ and any monomial u ∈ U, involutive monomial division L [3, ...
Programming and Computer Software, Vol. 28, No. 2, 2002, pp. 62–65. Original Russian Text Copyright © 2002 by Gerdt.

On an Algorithmic Optimization in Computation of Involutive Bases V. P. Gerdt Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna, Moscow oblast, 141980 Russia e-mail: [email protected] Received May 20, 2001

Abstract—An optimization of a general algorithm for computation of the minimal involutive basis is suggested. It can be applied for an arbitrary constructive involutive division. The optimization suggested minimizes the number of redistributions between elements of an intermediate basis required in the process of computations

1. INTRODUCTION A general algorithm for construction of canonical minimal bases, i.e., the bases that are uniquely determined by a given ideal and the order on monomials, has been suggested in [1, 2] in the framework of the general approach for construction of involutive polynomial bases [3]. In work [4], this algorithms has been generalized to the case of linear systems of partial differential equations. Recently, a specialized version of this algorithm for construction of monomial and polynomial Janet bases, which is based on optimization of computations that takes into account specific features of the Janet division, has been developed and implemented in the @Reduce, C, and C++ languages [5, 6]. This version, in particular, makes use of the Janet trees as data structures and an algorithm of fast search for a Janet divisor based on them [7]. In construction of minimal involutive bases, elements of intermediate bases are stored as two nonintersecting sets T and Q such that involutive normal forms of elements of Q are successively calculated modulo set T and all nonzero forms are moved from Q to T. If, in the process, the monomial ideal generated by leading monomials of polynomials from T is extended, then all polynomials whose leading monomials are higher than the leading monomial of the nonzero normal form under consideration are moved from T to Q. In this paper, we suggest an optimization of the above-discussed algorithm, which is based on minimization of the number of the required transfers of elements from T to Q. Specifically, we will show that it is sufficient to move only those polynomials whose leading (highest with respect to the order) elements are multiple of the leading monomial of the normal form computed. The optimization suggested is applicable to an arbitrary continuous involutive division [3, 8]. In particular, it improves the algorithm suggested in [6] for the Janet bases.

2. BASIC DEFINITIONS AND NOTATION In what follows, we use the following notation:  is d

d

the set of nonnegative integers,  = { x 1 1 … x n n |di ∈ } is a set of monomials in the ring  = [x1, …, xn] of polynomials over the field  of zero characteristic, and  is an admissible order on the monomials satisfying the conditions (1) u  1, u1  u2 ⇔ u1u  u2u for all u ∈  \{1}. If a monomial u divides a monomial v, we write u |v. If, in this case, u ≠ v, u is said to be a proper divisor of v. For a given order , the leading monomial of a polynomial f ∈  is denoted by lm( f ). If F ⊂  is a set of polynomials, then lm(F) denotes the set of their leading monomials, and Id(F) denotes the ideal generated by the set F. For any finite set of monomials U ⊂  and any monomial u ∈ U, involutive monomial division L [3, 8] specifies a partition of variables into (L)-multiplicative and (L)-nonmultiplicative ones. Accordingly, u ∈ U is an (involutive) L-divisor of a monomial v ∈  and the monomial v is an L-multiple of the monomial u if u |v and the monomial w = v/u contains only L-multiplicative variables for u. In this case, we write u |Lv. For given U and u ∈ U, NML(u, U) will denote the set of Lnonmultiplicative variables of the monomial u. By now, a number of involutive divisions have been constructed and examined [1, 2, 8, 9]. A monomial set U ∈  is referred to as L-autoreduced if any pair of different monomials u, v ∈ U satisfies the condition uL(u, U) ∩ vL(v, U) ≠ ∅, where L(u, U) ∈  denotes the set of monomials composed of L-multiplicative variables for u [3, 8]. A division L is called continuous [3, 8] if, for any finite set U ∈  and any finite sequence {ui}1 ≤ i ≤ k of elements from U such that ( ∀i < k ) ( ∃ x j ∈ N M L ( u i, U ) ) [ u i + 1 L u i x j ],

0361-7688/02/2802-0062$27.00 © 2002 åÄIä “Nauka /Interperiodica”

ON AN ALGORITHMIC OPTIMIZATION IN COMPUTATION OF INVOLUTIVE BASES

the inequality ui ≠ uj holds for all i ≠ j. For a given continuous involutive division L, a finite L-autoreduced set of monomials U is an (involutive) Lbasis [1] of the monomial ideal Id(U) if the following conditions are satisfied: ( ∀u ∈ U ) ( ∀ x ∈ N M L ( u, U ) ) ( ∃v ∈ U ) [ v L ux ].

(2)

An L-basis U of the ideal Id(U) is referred to as minimal if, for any other L-basis V generating the ideal Id(U), we have U ⊂ V. A set of monomials W is referred to as L-compact with respect to the ideal Id(U) if Id(W) = Id(U) and W ⊆ U, where U is the minimal involutive basis of Id(U). Similarly, a finite set F ⊂  of polynomials is Lautoreduced if the set lm(F) of its leading monomials is L-autoreduced and each polynomial f ∈ F does not contain lower (other than leading) monomials that are Lmultiple of any monomial from lm(F). For a continuous involutive division L, an L-autoreduced set of polynomials F is an (involutive) L-basis [1] of the polynomial ideal Id(F) ⊆  if the conditions ( ∀ f ∈ F ) ( ∀ x ∈ N M L ( lm ( f ), lm ( F ) ) [ N F L ( fx, F ) = 0 ]

(3)

hold, where NFL(p, P) denotes an L-involutive normal form [3] of the polynomial p with respect to the set of polynomials P. An L-basis F is called minimal if lm(F) is the minimal L-basis of the monomial ideal generated by it. 3. ALGORITHM FOR CONSTRUCTION OF MINIMAL INVOLUTIVE BASES AND ITS OPTIMIZATION First, we consider monomial bases. For a given finite set of monomials U ∈  and an involutive division L, the following algorithm constructs a minimal Lbasis for the ideal Id(U) generated by this set. Unlike monomial algorithms discussed in [1, 2, 5, 8], this algorithm repeatedly considers the same nonmultiplicative extensions and, thus, is less efficient. However, it is to this form of the monomial algorithm that the simplest version of the polynomial algorithm considered below reduces. For this reason, in order to describe the optimization of the latter, we represent the monomial algorithm in the form shown in Fig. 1. In the course of the algorithm operation, elements of an intermediate basis are distributed between sets U and Q. The set Q contains also nonmultiplicative extensions of the elements that are to be considered in accordance with conditions (2). The algorithm terminates when Q becomes empty. Thus, the InvolutiveMonomialBasis algorithm constructs a minimal L-basis for any Noetherian continuous and constructive involutive division [2]. The admissibility of the strategy of choosPROGRAMMING AND COMPUTER SOFTWARE

Vol. 28

63

Input: U – set of monomials, L – involutive division Output: U – minimal L-basisfor the ideal Id(U) 1: chosse u ∈ U without a proper divisor in U\{u} 2: U: = {u} 3: Q: = U \{u} 4: While Q ≠ ∅ do 5: chosse u ∈ Q without a proper divisor in Q\{u} 6: Q: = Q \{u} – 7: if –u has–no an L-divisor in U then 8: U: = U ∪{u} – 9: Q: = Q ∪{u x | u ∈ U, x ∈ NML(u, U)} 10: fi 11: od Fig. 1. Algorithm InvolutiveMonomialBasis(U, L).

ing extensions used on Step 5 of the algorithm is proven in [2, 5]. A computationally efficient version of the monomial algorithm designed for the Janet division and based on specific features of the Janet division, as well as its program implementation in C, are discussed in [5]. Correctness of the InvolutiveMonomialBasis algorithm relies on the following facts: first, it calculates the basis of the original monomial ideal, and, second, it ensures compactness of the intermediate monomial set U with respect to the ideal Id( U ). The InvolutivePolynomialBasis algorithm presented in Fig. 2 constructs a minimal L-basis in the polynomial case [6]. Instead of a monomial set U , we now use a polynomial set G. Similarly to the monomial case, to meet conditions (3), all nonmultiplicative extensions of polynomials from G are placed into Q in line 15 of the algorithm, and their involutive normal forms are calculated in line 8. Then, all nonzero normal forms are placed into the set G. As in the monomial case, the set U is supplemented by nonmultiplicative extensions of its elements that have no L-divisors in U . However, in contrast to the monomial case, in order that to get the minimal basis, it is required in certain cases, when placing a nonzero normal form h into the set G, to transfer some elements of the latter set to the set Q. In the InvolutivePolynomialBasis algorithm, as well as in its improved analogs [1, 2, 5], such a transfer is done (on Steps 12–14) for all polynomials from G whose leading monomials are higher than the leading monomial of the normal form being placed. The basic result of this work is as follows. We will show that, on Step 13 of the algorithm, it is sufficient to move from G to Q only those polynomials g ∈ G whose leading terms lm(g) are multiple (with respect to ordinary division) of the leading monomial lm(h) of the polynomial h. This implies that line 12 of the InvolutivePolynomialBasis algorithm can be replaced by a line with the weaker condition for all {g ∈ G|lm(h) divides lm(g)} do (4) No. 2

2002

64

GERDT Input: F ∈ R\{0} – set of polynomials; L – involutive division; s – admissible order on monomials Output: G – minimal L-basis of the ideal Id(F) 1: chosse f ∈ F with the lowest lm(f) with respect to a 2: G: = {f}; Q: = F\G 3: do 4: h: = 0 5: do Q: ≠ ∅ and h = 0 6: chosse p ∈ Q with lm(p) without proper divisor in {lm(q) | q ∈ Q\{p}} 7: Q: = Q \{p} 8: h: = NFL(p, G) 9: od 10: if h ≠ 0 then 11: G: = G ∪{h} 12: for all {g ∈ G | lm(g) s lm(h)} do 13: Q: = Q ∪{g}; G: = G\{g} 14: od 15: Q: = Q ∪{NFJ(g · x, G) | g ∈ G, x ∈ NML(g, G), NFL(g · x, G) ≠ 0} 16: fi 17: od while Q ≠ ∅ Fig. 2. Algorithm InvolutivePolynomialBasis(F, L, ).

The fact that the new condition is weaker than the old one follows from properties (1) of the order . Indeed, according to these conditions, any monomial lm(g) that is a multiple of the monomial lm(h) is higher than the latter monomial with respect to any admissible order  on monomials. The case of lm(g) = lm(h) is excluded by the condition on Step 8, which guarantees that none of monomials of the polynomial h can be an L-multiple of lm(g), and any monomial is an involutive divisor of itself in accordance with the definition of the involutive division [3, 8]. Thus, condition (4) implies the fulfillment of the condition of Step 12 of the InvolutivePolynomialBasis algorithm. The converse is generally not true, which can be seen from the following simple example. Let  be a lexicographical order: x1  x2  … such that x1 does not divide x2. Hence, in the case of the old condition (5), if x1 becomes the leading monomial of h on Step 8, the fact that the intermediate basis T contains a polynomial with the leading monomial x2 would result in the transfer of this polynomial from T to Q. At the same time, this transfer is not required by the new condition (4). Note that the ordinary monomial divisibility in condition (4) cannot be replaced by an involutive divisibility; at least, this is not possible in the case of an arbitrary involutive division. To show this, consider, for definiteness, the Janet division [3, 8]. Since the polynomial h obtained on Step 8 is in the normal form modulo G, lm(h) ≠ lm(g) for all g ∈ G. Accordingly, when placing h into G on Step 11, the condition lm(h)|Llm(g) is never fulfilled in the loop 5-17 for any g ∈ G by virtue

of the property of the Janet division that any set of different monomials is involutively autoreduced by this division [1]. In the general case, this implies that the Janet basis computed is not minimal. In the case of the well-known involutive Pommaret division, which is globally defined [3, 8], the replacement of ordinary divisibility by the involutive one in condition (4) is quite correct [3]. Let us prove now correctness of the replacement of the condition for all {g ∈ G|lm(g)  lm(h)} do

(5)

in line 12 of the InvolutivePolynomialBasis algorithm by condition (4). For this, it is sufficient to show that, at the beginning of each outer loop do while, the polynomial set G contains a compact set lm(G) of its leading monomials with respect to the ideal Id(lm(G)). Such preservation of compactness of lm(G) in the course of the algorithm operation ensures minimality of the Lbasis obtained in accordance with the definitions of Section 2. The proof is similar to the proof of correctness of condition (5) given in [1]. At the moment of initialization on Step 2, the set G consists of one polynomial, and the compactness condition is trivially fulfilled. If the set of monomials lm(G) is compact and the leading monomial lm(h) of the polynomial being placed has no multiples among elements of lm(G), then the placement of h into G on Step 11 does not violate compactness of the latter set by virtue of Lemma 1 in [5], which ensures correctness of the InvolutiveMonomialBasis algo-

PROGRAMMING AND COMPUTER SOFTWARE

Vol. 28

No. 2

2002

ON AN ALGORITHMIC OPTIMIZATION IN COMPUTATION OF INVOLUTIVE BASES

rithm, where such a placement implemented on Step 8 preserves compactness of the intermediate monomial set U with respect to the monomial ideal generated by it. It remains to show that, if lm(h) divides some elements of lm(G) in the ordinary sense, then the transfer of the corresponding polynomials from G to Q implemented on Step 13 ensures compactness of leading monomials of the set G1 ⊂ G ∪ {h} obtained as a result of that transfer implemented on Steps 11 and 13. Note that the compactness of G1 is considered with respect to the monomial ideal generated by lm(G) ∪ {lm(h)}. Assume the contrary; i.e., let the monomial set U = lm(G1) be not compact. Then, it contains a certain largest subset V ⊂ U that is compact with respect to the ideal Id(V) = Id(U), where V = lm(G2), G2 ⊂ G1, and there exists a polynomial p ∈ G1\G2 such that the monomial u = lm(p) ∈ U has an L-divisor v ∈ V, which is a leading monomial v = lm(q) of a polynomial q ∈ G2. If there are several such polynomials, we choose one the leading monomial of which has no proper divisors among leading monomials of other polynomials from G1\G2. The polynomial q cannot be identical to h since any L-divisor is also an ordinary divisor [3, 8], but all polynomials whose leading monomials are multiple of lm(h) have been already moved to Q in accordance with condition (4). On the other hand, q ∈ G2\h contradicts to the fact that lm(G) is compact, since addition of the polynomial h to the set G can only increase the number of L-nonmultiplicative variables. The fact that the number of L-multiplicative variables does not decrease upon extension of the set of polynomials (correspondingly, leading monomials) is true for any division L [3, 8]. Hence, if the set of monomials V1 = V\{lm(h)} that is compact with respect to the ideal Id(U\{lm(h)}) is completed by the InvolutiveMonomialBasis algorithm up to an L-involutive basis of the ideal Id(U) = Id(lm(G)), then, in accordance with our choice of the polynomial p, we can take lm(p) as the first element of the completion V. Then, it follows that V1 ∪ {lm(p)} ⊆ U is to be compact with respect to the ideal Id(U), which contradicts to the assumption made above. 4. CONCLUSION In this paper, we proved correctness of the replacement of condition (5) for transfer of elements from G to Q in the InvolutivePolynomialBasis algorithm by the weaker condition (4). In practice, such a replacement implies a considerable reduction in computations required for these transfers, especially in the cases where the number of variables is great such that the

PROGRAMMING AND COMPUTER SOFTWARE

Vol. 28

65

number of transfers by the old condition is considerably greater than that by the new condition. Accordingly, in the case of program implementation of the algorithm for calculation of the polynomial Janet basis [6], this implies reduction of expenditures required for reconstruction of the Janet tree and for recalculation of multiplicative and nonmultiplicative variables associated with it. It should be noted, however, that main computational expenditures are associated, as a rule, with operations on long numbers (arithmetic). Therefore, the optimization suggested in this work gives a relatively small gain in total computation time in problems where large coefficients are involved in intermediate calculations, such as, e.g., problems considered in [6]. ACKNOWLEDGMENT This work was supported in part by the Russian Foundation for Basic Research, project nos. 00-1596691 and 01-01-00708, and by INTAS, project no. 991222. REFERENCES 1. Gerdt, V.P. and Blinkov, Yu.A., Minimal Involutive Bases, Math. Comput. Simulation, 1998, vol. 45, pp. 543–560. 2. Gerdt, V.P., Involutive Division Technique: Some Generalizations and Optimizations, Zap. nauchn. seminarov SPOMI (St. Petersburg), 1998, vol.258, pp. 185–206. 3. Gerdt, V.P. and Blinkov, Yu.A., Involutive Bases of Polynomial Ideals, Math. Comput. Simulation, 1998, vol. 45, pp. 519–542. 4. Gerdt, V.P., Completion of Linear Differential Systems to Involution, Computer Algebra in Scientific Computing, Ganzha, V.G., Mayr, E.W., and Vorozhtsov, E.V., Eds., Berlin: Springer, 1999, pp.115–137. 5. Gerdt, V.P., Blinkov, Yu.A., and Yanovich, D.A., Construction of Janet Bases I. Monomial Bases, Computer Algebra in Scientific Computing, CASC’99, Ganzha, V.G., Mayr, E.W., and Vorozhtsov, E.V., Eds., Berlin: Springer, 2001, pp. 233–247. 6. Gerdt, V.P., Blinkov, Yu.A., and Yanovich, D.A., Construction of Janet Bases II. Polynomial Bases, Computer Algebra in Scientific Computing, CASC’99, Ganzha, V.G., Mayr, E.W., and Vorozhtsov, E.V., Eds., Berlin: Springer, 2001, pp. 249–263. 7. Gerdt, V.P., Blinkov, Yu.A., and Yanovich, D.A., Fast Search for the Janet Divisor, Programmirovanie, 2001, no. 1, pp. 22–24. 8. Gerdt, V.P. and Blinkov, Yu.A., Involutive Division of Monomials, Programmirovanie, 1998, no. 6, pp. 22–24. 9. Chen, Yu-Fu and Gao, X.-S., Vector Representation of Involutive Divisions, Mathematics-Mechanization Research Preprints, Beijing, 1999, no. 18, pp. 9–22.

No. 2

2002