source: git/Singular/mpsr_PutPoly.cc @ 663519a

fieker-DuValspielwiese
Last change on this file since 663519a was 126cfa, checked in by Olaf Bachmann <obachman@…>, 27 years ago
Sun May 4 11:14:44 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> * Added make target mpcheck; Update INSTALL file * mpsr_PutPoly.cc (PutRationalNumber): Normalize if number->s == 0 and not if number->s == 2 * mpsr_GetPoly.cc (GetGaloisNumber): Introduced special routines, since npInit op in GetModuloNumber messed things up git-svn-id: file:///usr/local/Singular/svn/trunk@234 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 21.7 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4
5/* $Id: mpsr_PutPoly.cc,v 1.7 1997-05-04 11:11:54 obachman Exp $ */
6
7/***************************************************************
8 *
9 * File:       mpsr_PutPoly.cc
10 * Purpose:    rotines which put polys and polynomails (i.e. ring) annotations
11 * Author:     Olaf Bachmann (10/95)
12 *
13 * Change History (most recent first):
14 *  o 1/97 obachman
15 *    Updated routines to MP and MPP v1.1
16 *
17 ***************************************************************/
18#include "mod2.h"
19
20#ifdef HAVE_MPSR
21
22#include "mpsr_Put.h"
23#include "mpsr_Tok.h"
24#include "longalg.h"
25#include "mmemory.h"
26#include "ring.h"
27#include "polys.h"
28#include "ipid.h"
29
30#ifdef PARI_BIGINT_TEST
31#include "MP_PariBigInt.h"
32MP_Status_t MP_MyPutApIntPacket(MP_Link_pt link, MP_ApInt_t mp_apint,
33                                MP_NumAnnot_t num_annots)
34{
35  GEN pnum = _gmp_to_pari((mpz_ptr) mp_apint);
36  return MP_PutApIntPacket(link, (MP_ApInt_t) pnum, num_annots);
37}
38
39#else
40
41#define MP_MyPutApIntPacket MP_PutApIntPacket
42
43#endif
44
45/***************************************************************
46 *
47 * global variable definitions
48 *
49 ***************************************************************/
50
51mpsr_Status_t (*PutCoeff)(MP_Link_pt link, number x);
52mpsr_Status_t (*PutAlgAlgNumber)(MP_Link_pt link, number x);
53MP_Uint32_t gNalgvars = 0;
54MP_Sint32_t gNvars = 0;
55MP_Sint32_t *gTa = NULL;
56ring        CurrPutRing = NULL;
57
58
59/***************************************************************
60 *
61 * prototype declarations
62 *
63 ***************************************************************/
64static void        SetPutFuncs(ring r);
65static mpsr_Status_t PutModuloNumber(MP_Link_pt link, number a);
66static mpsr_Status_t PutFloatNumber(MP_Link_pt link, number a);
67static mpsr_Status_t PutRationalNumber(MP_Link_pt link, number a);
68static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alg a);
69static mpsr_Status_t PutAlgNumber(MP_Link_pt link, number a);
70
71static mpsr_Status_t PutVarNamesAnnot(MP_Link_pt link, ring r);
72static mpsr_Status_t PutVarNumberAnnot(MP_Link_pt link, ring r, BOOLEAN mv);
73static mpsr_Status_t PutOrderingAnnot(MP_Link_pt link, ring r, BOOLEAN mv);
74static mpsr_Status_t PutSimpleOrdering(MP_Link_pt link, ring r, short index);
75static mpsr_Status_t PutProtoTypeAnnot(MP_Link_pt link, ring r, BOOLEAN mv);
76static mpsr_Status_t PutMinPolyAnnot(MP_Link_pt link, ring r);
77static mpsr_Status_t PutDefRelsAnnot(MP_Link_pt link, ring r);
78
79/***************************************************************
80 *
81 * Setting the global Put Functions
82 *
83 ***************************************************************/
84static void SetPutFuncs(ring r)
85{
86  CurrPutRing = r;
87  // first, we set the PutNumber function
88  if (r->N != gNvars)
89  {
90    if (gTa != NULL)
91      Free(gTa, (gNvars+1)*sizeof(MP_Sint32_t));
92
93    gNvars = r->N;
94    if (gNvars > 1)
95      gTa = (MP_Sint32_t *) Alloc((gNvars+1)*sizeof(MP_Sint32_t));
96    else
97      gTa = NULL;
98  }
99
100  if ((r->ch) == 0)
101    // rational numbers
102    PutCoeff= PutRationalNumber;
103  else if ((r->ch) > 1)
104    // Form our point of view, ModuloP numbers and numbers from
105    // GF(p,n) are the same, here. They only differ in the annots
106    PutCoeff = PutModuloNumber;
107  else if ((r->ch) == -1)
108    PutCoeff = PutFloatNumber;
109  else
110  {
111    // now we come to algebraic numbers
112    gNalgvars = rPar(r);
113    PutCoeff = PutAlgNumber;
114    if ((r->ch) < 0)
115      // first, Z/p(a)
116      PutAlgAlgNumber = PutModuloNumber;
117    else
118      PutAlgAlgNumber = PutRationalNumber;
119  }
120}
121
122
123
124/***************************************************************
125 *
126 * modulo numbers (i.e. char p, or p^n)
127 *
128 ***************************************************************/
129// we always put modulo numbers without a header, since
130// we have type-spec this before
131static mpsr_Status_t PutModuloNumber(MP_Link_pt link, number a)
132{
133  mp_return(IMP_PutUint32(link, (MP_Uint32_t) a));
134}
135
136static mpsr_Status_t PutFloatNumber(MP_Link_pt link, number a)
137{
138  mp_return(IMP_PutReal32(link , Number_2_Real32(a)));
139}
140
141/***************************************************************
142 *
143 * rational (i.e. char 0) numbers
144 *
145 ***************************************************************/
146// This supposes that number is of char 0, i.e. a rational number
147static mpsr_Status_t PutRationalNumber(MP_Link_pt link, number a)
148{
149  // Check for case number == NULL == 0
150  if (a == NULL)
151    mp_return( MP_PutSint32Packet(link, 0, 0));
152 
153  // check for SR_INT type
154  if (SR_HDL(a) & SR_INT)
155    mp_return( MP_PutSint32Packet(link, SR_TO_INT(a), 0));
156
157  // check for single GMP integer
158  if ((a->s) == 3)
159    mp_return(MP_MyPutApIntPacket(link, (MP_ApInt_t) &(a->z), 0));
160
161  // Now we have a fraction
162  // normalize, if necessary
163  if ((a->s) == 0)
164  {
165    nlNormalize(a);
166    return PutRationalNumber(link, a);
167  }
168 
169  // send number itself
170  mp_failr(MP_PutCommonOperatorPacket(link,
171                                      MP_BasicDict,
172                                      MP_CopBasicDiv,
173                                      0,
174                                      2));
175  // and now sent nominator and denominator
176  mp_failr(MP_MyPutApIntPacket(link, (MP_ApInt_t) &(a->z), 0));
177  mp_return(MP_MyPutApIntPacket(link, (MP_ApInt_t) &(a->n), 0));
178}
179
180/***************************************************************
181 *
182 * Algebraic Numbers (a la Singular)
183 *
184 ***************************************************************/
185inline MP_Uint32_t GetPlength(alg a)
186{
187  MP_Uint32_t i = 0;
188  while (a != NULL)
189  {
190    i++;
191    a = a->ne;
192  }
193  return i;
194}
195
196static mpsr_Status_t PutAlgNumber(MP_Link_pt link, number a)
197{
198  lnumber b;
199
200  if (a == NULL)
201    mp_return(IMP_PutUint32(link, 0));
202
203  b = (lnumber) a;
204  if ((b->n) == NULL) // NULL means there is only one number
205  {
206    // hence, we use the first case of the union
207    mp_failr(IMP_PutUint32(link, 1));
208    mp_failr(IMP_PutUint32(link, GetPlength(b->z)));
209    return PutAlgPoly(link, (alg) (b->z));
210  }
211  else
212  {
213    // we use the 2nd case of the union
214    mp_failr(IMP_PutUint32(link, 2));
215    mp_failr(IMP_PutUint32(link, GetPlength(b->z)));
216    failr(PutAlgPoly(link, (alg) (b->z)));
217    mp_failr(IMP_PutUint32(link, GetPlength(b->n)));
218    return PutAlgPoly(link, (alg) (b->n));
219  }
220}
221
222// this is very similar to putting a Poly
223static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alg a)
224{
225  int i;
226  int *exp;
227
228  if (gNalgvars > 1)
229    while (a != NULL)
230    {
231      failr(PutAlgAlgNumber(link, a->ko));
232      mp_failr(IMP_PutSint32Vector(link, (MP_Sint32_t *) a->e, gNalgvars));
233      a = a->ne;
234    }
235  else
236  {
237    while (a != NULL)
238    {
239      failr(PutAlgAlgNumber(link, a->ko));
240      IMP_PutSint32(link, (MP_Sint32_t) a->e[0]);
241      a = a->ne;
242    }
243  }
244  return mpsr_Success;
245}
246
247/***************************************************************
248 *
249 *  Putting polys
250 *
251 ***************************************************************/
252mpsr_Status_t mpsr_PutPolyData(MP_Link_pt link, poly p, ring cring)
253{
254  monomial exp;
255
256  if (cring != CurrPutRing)
257    SetPutFuncs(cring);
258
259#ifdef MPSR_DEBUG
260  if (currRing == cring)
261    pTest(p);
262#endif
263 
264  if (gNvars > 1)
265  {
266    short i;
267    MP_Sint32_t *ta1 = &(gTa[1]);
268   
269    while (p != NULL)
270    {
271      failr(PutCoeff(link, pGetCoeff(p)));
272      for (i=1, exp = p->exp; i<=gNvars; i++)
273        gTa[i] = (MP_Sint32_t) exp[i];
274      mp_failr(IMP_PutSint32Vector(link, ta1, gNvars));
275      pIter(p);
276    }
277  }
278  else
279    while (p != NULL)
280    {
281      failr(PutCoeff(link, pGetCoeff(p)));
282      IMP_PutSint32(link, (MP_Sint32_t) p->exp[1]);
283      pIter(p);
284    }
285  return mpsr_Success;
286}
287
288mpsr_Status_t mpsr_PutPolyVectorData(MP_Link_pt link, poly p, ring cring)
289{
290  short i, n1;
291  monomial exp;
292
293  if (cring != CurrPutRing)
294    SetPutFuncs(cring);
295 
296  if (gNvars > 1)
297  {
298    short i, n1= gNvars + 1;
299    while (p != NULL)
300    {
301      failr(PutCoeff(link, pGetCoeff(p)));
302      for (i=0, exp = p->exp; i< n1; i++)
303        gTa[i] = (MP_Sint32_t) exp[i];
304      mp_failr(IMP_PutSint32Vector(link, gTa, n1));
305      pIter(p);
306    }
307  }
308  else
309    while (p != NULL)
310    {
311      failr(PutCoeff(link, pGetCoeff(p)));
312      IMP_PutSint32(link, (MP_Sint32_t) p->exp[0]);
313      IMP_PutSint32(link, (MP_Sint32_t) p->exp[1]);
314      pIter(p);
315    }
316  return mpsr_Success;
317}
318
319/***************************************************************
320 *
321 *  The putting annotation buisness
322 *
323 ***************************************************************/
324int mpsr_GetNumOfRingAnnots(ring r, BOOLEAN mv)
325{
326  short annots = 4;
327
328  if (mv) annots++;
329  if (r->qideal != NULL) annots++;
330  // we sent the minpoly with the coefficient ring
331  if (r->minpoly != NULL & r->parameter == NULL) annots++;
332
333  return annots;
334}
335
336mpsr_Status_t mpsr_PutRingAnnots(MP_Link_pt link, ring r, BOOLEAN mv)
337{
338  failr(PutProtoTypeAnnot(link,r, mv));
339  failr(PutVarNumberAnnot(link, r, mv));
340  failr(PutVarNamesAnnot(link,r));
341  failr(PutOrderingAnnot(link,r, mv));
342
343  if (mv)
344    mp_failr(MP_PutAnnotationPacket(link,
345                                    MP_PolyDict,
346                                    MP_AnnotPolyModuleVector,
347                                    MP_AnnotRequired));
348  // Hmm .. this is not according to a "proper" Singular ring,
349  // but to be used in a recursive call of mpsr_PutRingAnnots
350  if (r->minpoly != NULL && r->parameter == NULL && r->ch > 0)
351    failr(PutMinPolyAnnot(link,r));
352 
353  if (r->qideal != NULL)
354    return PutDefRelsAnnot(link, r);
355
356  return mpsr_Success;
357}
358
359static mpsr_Status_t PutProtoTypeAnnot(MP_Link_pt link, ring r,
360                                       BOOLEAN mv)
361{
362  // each element of the poly is a
363  mp_failr(MP_PutAnnotationPacket(link,
364                                  MP_ProtoDict,
365                                  MP_AnnotProtoPrototype,
366                                  MP_AnnotReqValNode));
367  // Monom represented as a struct of 2 elements
368  mp_failr(MP_PutCommonOperatorPacket(link,
369                                      MP_ProtoDict,
370                                      MP_CopProtoStruct,
371                                      0,
372                                      2));
373
374  // First element is the coefficient
375  if ((r->ch) == 0)
376  {
377    // rational numbers
378    mp_failr(MP_PutCommonMetaTypePacket(link,
379                                        MP_NumberDict,
380                                        MP_CmtNumberRational,
381                                        1));
382    // are always normalized (and made that way, if necessary)
383    mp_failr(MP_PutAnnotationPacket(link,
384                                    MP_NumberDict,
385                                    MP_AnnotNumberIsNormalized,
386                                    0));
387  }
388  else if ((r->ch) > 1)
389  {
390    // modulo p numbers
391    // are communicated as IMP_Uint32's
392    mp_failr(MP_PutCommonMetaTypePacket(link,
393                                    MP_ProtoDict,
394                                    MP_CmtProtoIMP_Uint32,
395                                    1));
396    // but are taken as modulo numbers
397    mp_failr(MP_PutAnnotationPacket(link,
398                                    MP_NumberDict,
399                                    MP_AnnotNumberModulos,
400                                    MP_AnnotValuated));
401    // with Modulo
402    mp_failr(MP_PutUint32Packet(link, r->ch, 1));
403    if (r->parameter == NULL)
404    {
405      // which is (in our case) always a prime number
406      mp_failr(MP_PutAnnotationPacket(link,
407                                      MP_NumberDict,
408                                      MP_AnnotNumberIsPrime,
409                                      0));
410    }
411    else
412    {
413      mp_failr(MP_PutAnnotationPacket(link,
414                                      MP_SingularDict,
415                                      MP_AnnotSingularGalois,
416                                      MP_AnnotValuated));
417      mp_failr(MP_PutStringPacket(link, r->parameter[0], 0));
418    }
419  }
420  else if ((r->ch) == -1)
421  {
422    // floats
423    mp_failr(MP_PutCommonMetaTypePacket(link,
424                                    MP_ProtoDict,
425                                    MP_CmtProtoIMP_Real32,
426                                    0));
427  }
428  else
429  {
430    // alg numbers
431    // create temporary ring for describing the coeeficient domain
432    ring alg_r = (ring) Alloc0(sizeof(sip_sring));
433
434    alg_r->N = rPar(r);
435    alg_r->ch = (r->ch < 0 ? - (r->ch) : 0);
436    alg_r->order = (int *) Alloc(3*sizeof(int));
437    alg_r->order[2] = ringorder_no;
438    alg_r->order[1] = ringorder_C;
439    alg_r->order[0] = ringorder_lp;
440    alg_r->names = r->parameter;
441    alg_r->minpoly = r->minpoly;
442
443    // Algebraic numbers are
444    // a fraction of two Dense Dist Polys
445    mp_failr(MP_PutCommonMetaOperatorPacket(link,
446                                            MP_PolyDict,
447                                            MP_CopPolyDenseDistPolyFrac,
448                                            mpsr_GetNumOfRingAnnots(alg_r,0),
449                                            0));
450    failr(mpsr_PutRingAnnots(link, alg_r, 0));
451
452    // destroy temporary ring
453    Free(alg_r->order, 3*sizeof(int));
454    Free(alg_r, sizeof(sip_sring));
455  }
456
457  // second element is the exponent vector
458  mp_failr(MP_PutCommonMetaOperatorPacket(link,
459                                          MP_ProtoDict,
460                                          MP_CopProtoArray,
461                                          1,
462                                          (mv ? r->N + 1 : r->N)));
463  mp_failr(MP_PutAnnotationPacket(link,
464                                  MP_ProtoDict,
465                                  MP_AnnotProtoPrototype,
466                                  MP_AnnotReqValNode));
467  mp_return(MP_PutCommonMetaTypePacket(link,
468                                   MP_ProtoDict,
469                                   MP_CmtProtoIMP_Sint32,
470                                   0));
471}
472
473   
474static mpsr_Status_t PutVarNamesAnnot(MP_Link_pt link, ring r)
475{
476  // first, we put the annot packet, with flags (1, 0, 1, 0)
477  mp_failr(MP_PutAnnotationPacket(link,
478                                  MP_PolyDict,
479                                  MP_AnnotPolyVarNames,
480                                  MP_AnnotValuated));
481  // now, the varnames follow
482  if ((r->N) == 1)
483  {
484    // only 1 varname
485    mp_return(MP_PutIdentifierPacket(link, MP_SingularDict, *(r->names), 0));
486  }
487  else
488  {
489    // more than one varname
490    char **names = r->names;
491    int i, n = r->N;
492
493    mp_failr(MP_PutCommonOperatorPacket(link,
494                                        MP_ProtoDict,
495                                        MP_CopProtoArray,
496                                        1,
497                                        r->N));
498    mp_failr(MP_PutAnnotationPacket(link,
499                                    MP_ProtoDict,
500                                    MP_AnnotProtoPrototype,
501                                    MP_AnnotReqValNode));
502                                 
503    mp_failr(MP_PutCommonMetaTypePacket(link,
504                                    MP_ProtoDict,
505                                    MP_CmtProtoIMP_Identifier,
506                                    0));
507    for (i=0; i<n; i++)
508      mp_failr(IMP_PutString(link, names[i]));
509
510    return mpsr_Success;
511  }
512}
513
514static mpsr_Status_t PutVarNumberAnnot(MP_Link_pt link, ring r, BOOLEAN mv)
515{
516  mp_failr(MP_PutAnnotationPacket(link,
517                                  MP_PolyDict,
518                                  MP_AnnotPolyVarNumber,
519                                  MP_AnnotValuated));
520  mp_return(MP_PutUint32Packet(link, (mv ? r->N + 1 : r->N), 0));
521}
522
523 
524static mpsr_Status_t PutOrderingAnnot(MP_Link_pt link, ring r, BOOLEAN mv)
525{
526  int index = 0, nblocks = 0;
527  int *order = r->order;
528
529  mp_failr(MP_PutAnnotationPacket(link,
530                                  MP_PolyDict,
531                                  MP_AnnotPolyOrdering,
532                                  MP_AnnotValuated));
533
534  // let's see whether we have a simple ordering to sent
535  if ((mv == 0) && (order[2] == ringorder_no))
536  {
537    if (order[1] == ringorder_C || order[1] == ringorder_c)
538      index = 0;
539    else
540      index = 1;
541
542    return PutSimpleOrdering(link, r, index);
543  }
544
545  // No -- so we are dealing with a product ordering
546  // First, let's find out how many blocks there are
547  while (order[nblocks] != ringorder_no) nblocks++;
548  // if we deal with a non-vector, we are not going to sent
549  // the vector ordering
550  mp_failr(MP_PutCommonOperatorPacket(link,
551                                      MP_BasicDict,
552                                      MP_CopBasicList,
553                                      0,
554                                      (mv ? nblocks : nblocks - 1)));
555
556  for (index = 0; index < nblocks; index ++)
557    // Do not sent vector ordering, if we are sending pure polys
558    if (! (mv == 0 && (order[index] == ringorder_C ||
559                       order[index] == ringorder_c)))
560    {
561      // a product ordering is sent as triple
562      mp_failr(MP_PutCommonOperatorPacket(link,
563                                          MP_BasicDict,
564                                          MP_CopBasicList,
565                                          0,
566                                          3));
567      // first element is the simple ordering
568      failr(PutSimpleOrdering(link, r, index));
569      // second and third for covered variables
570      mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) r->block0[index], 0));
571      mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) r->block1[index], 0));
572    }
573
574  return mpsr_Success;
575}
576
577
578static mpsr_Status_t PutSimpleOrdering(MP_Link_pt link, ring r, short index)
579{
580  MP_Uint32_t vlength = 0, i;
581
582  // find out the length of the weight-vector
583  if (r->wvhdl && r->wvhdl[index] != NULL)
584    vlength = r->block1[index] - r->block0[index] + 1;
585
586  mp_failr(MP_PutCommonConstantPacket(link,
587                                      MP_PolyDict,
588                                      mpsr_ord2mp(r->order[index]),
589                                      (vlength == 0 ? 0 : 1)));
590
591  if (vlength == 0) return mpsr_Success;
592
593  // deal with the weights
594  mp_failr(MP_PutAnnotationPacket(link,
595                                  MP_PolyDict,
596                                  MP_AnnotPolyWeights,
597                                  MP_AnnotValuated));
598  if (r->order[index] == ringorder_M)
599  {
600    // put the matrix header
601    mp_failr(MP_PutCommonOperatorPacket(link,
602                                        MP_MatrixDict,
603                                        MP_CopMatrixDenseMatrix,
604                                        2,
605                                        vlength*vlength));
606    mp_failr(MP_PutAnnotationPacket(link,
607                                    MP_ProtoDict,
608                                    MP_AnnotProtoPrototype,
609                                    MP_AnnotReqValNode));
610    mp_failr(MP_PutCommonMetaTypePacket(link,
611                                    MP_ProtoDict,
612                                    MP_CmtProtoIMP_Sint32,
613                                    0));
614    mp_failr(MP_PutAnnotationPacket(link,
615                                    MP_MatrixDict,
616                                    MP_AnnotMatrixDimension,
617                                    MP_AnnotReqValNode));
618    mp_failr(MP_PutCommonOperatorPacket(link,
619                                        MP_BasicDict,
620                                        MP_CopBasicList,
621                                        0, 2));
622    mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0));
623    mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0));
624    vlength *= vlength;
625  }
626  else
627  {
628    // vector header
629    mp_failr(MP_PutCommonOperatorPacket(link,
630                                        MP_MatrixDict,
631                                        MP_CopMatrixDenseVector,
632                                        1,
633                                        vlength));
634    mp_failr(MP_PutAnnotationPacket(link,
635                                    MP_ProtoDict,
636                                    MP_AnnotProtoPrototype,
637                                    MP_AnnotReqValNode));
638    mp_failr(MP_PutCommonMetaTypePacket(link,
639                                    MP_ProtoDict,
640                                    MP_CmtProtoIMP_Sint32,
641                                    0));
642  }
643
644  // weights are all what remains
645  for (i=0; i<vlength; i++)
646    mp_failr(IMP_PutSint32(link, (MP_Sint32_t) r->wvhdl[index][i]));
647
648  return mpsr_Success;
649}
650
651static mpsr_Status_t PutMinPolyAnnot(MP_Link_pt link, ring r)
652{
653  mpsr_assume(r->minpoly != NULL && r->ch > 0 && r->parameter == NULL);
654 
655  number minpoly = r->minpoly;
656  r->minpoly = 0;
657
658  mp_failr(MP_PutAnnotationPacket(link,
659                                  MP_PolyDict,
660                                  MP_AnnotPolyDefRel,
661                                  MP_AnnotValuated));
662  mp_failr(MP_PutCommonOperatorPacket(link,
663                                      MP_PolyDict,
664                                      MP_CopPolyDenseDistPoly,
665                                      5,
666                                      GetPlength( ((lnumber) minpoly)->z)));
667  failr(PutProtoTypeAnnot(link, r, 0));
668  failr(PutVarNamesAnnot(link, r));
669  failr(PutVarNumberAnnot(link, r,0));
670  failr(PutOrderingAnnot(link, r, 0));
671  mp_failr(MP_PutAnnotationPacket(link,
672                                  MP_PolyDict,
673                                  MP_AnnotPolyIrreducible,
674                                  0));
675
676  // need to set PutAlgAlgnumber and gNalgVars
677  CurrPutRing = r;
678  if (r->ch > 0)
679    PutAlgAlgNumber = PutModuloNumber;
680  else
681    PutAlgAlgNumber = PutRationalNumber;
682  gNalgvars = r->N;
683 
684  r->minpoly = minpoly;
685  return PutAlgPoly(link, ((lnumber) minpoly)->z);
686}
687
688 
689static mpsr_Status_t PutDefRelsAnnot(MP_Link_pt link, ring r)
690{
691  int i, idn;
692  ideal id;
693
694  id = r->qideal;
695  r->qideal = NULL;
696
697  mp_failr(MP_PutAnnotationPacket(link,
698                                  MP_PolyDict,
699                                  MP_AnnotPolyDefRel,
700                                  MP_AnnotValuated));
701  failr(mpsr_PutIdeal(link, id, r));
702  r->qideal = id;
703  return mpsr_Success;
704}
705
706#endif
Note: See TracBrowser for help on using the repository browser.