source: git/Singular/mpsr_PutPoly.cc @ 5480da

spielwiese
Last change on this file since 5480da was 427ba9, checked in by Olaf Bachmann <obachman@…>, 26 years ago
* small bug fixes git-svn-id: file:///usr/local/Singular/svn/trunk@1283 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 22.1 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4
5/* $Id: mpsr_PutPoly.cc,v 1.10 1998-03-27 11:40:59 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  if (cring != CurrPutRing)
255    SetPutFuncs(cring);
256
257#ifdef MPSR_DEBUG
258  if (currRing == cring)
259    pTest(p);
260#endif
261 
262  if (gNvars > 1)
263  {
264    short i;
265    MP_Sint32_t *ta1 = &(gTa[1]);
266   
267    while (p != NULL)
268    {
269      failr(PutCoeff(link, pGetCoeff(p)));
270      for (i=1; i<=gNvars; i++)
271        gTa[i] = (MP_Sint32_t) pGetExp(p, i);
272      mp_failr(IMP_PutSint32Vector(link, ta1, gNvars));
273      pIter(p);
274    }
275  }
276  else
277    while (p != NULL)
278    {
279      failr(PutCoeff(link, pGetCoeff(p)));
280      IMP_PutSint32(link, (MP_Sint32_t) pGetExp(p,1));
281      pIter(p);
282    }
283  return mpsr_Success;
284}
285
286mpsr_Status_t mpsr_PutPolyVectorData(MP_Link_pt link, poly p, ring cring)
287{
288  short i, n1;
289
290  if (cring != CurrPutRing)
291    SetPutFuncs(cring);
292 
293  if (gNvars > 1)
294  {
295    short i, n1= gNvars + 1;
296    while (p != NULL)
297    {
298      failr(PutCoeff(link, pGetCoeff(p)));
299      gTa[0] = pGetComp(p);
300      for (i=1; i< n1; i++)
301        gTa[i] = (MP_Sint32_t) pGetExp(p,i);
302      mp_failr(IMP_PutSint32Vector(link, gTa, n1));
303      pIter(p);
304    }
305  }
306  else
307    while (p != NULL)
308    {
309      failr(PutCoeff(link, pGetCoeff(p)));
310      IMP_PutSint32(link, (MP_Sint32_t) pGetComp(p));
311      IMP_PutSint32(link, (MP_Sint32_t) pGetExp(p,1));
312      pIter(p);
313    }
314  return mpsr_Success;
315}
316
317/***************************************************************
318 *
319 *  The putting annotation buisness
320 *
321 ***************************************************************/
322int mpsr_GetNumOfRingAnnots(ring r, BOOLEAN mv)
323{
324  short annots = 4;
325
326  if (mv) annots++;
327  if (r->qideal != NULL) annots++;
328  // we sent the minpoly with the coefficient ring
329  if (r->minpoly != NULL & r->parameter == NULL) annots++;
330
331  return annots;
332}
333
334mpsr_Status_t mpsr_PutRingAnnots(MP_Link_pt link, ring r, BOOLEAN mv)
335{
336  failr(PutProtoTypeAnnot(link,r, mv));
337  failr(PutVarNumberAnnot(link, r, mv));
338  failr(PutVarNamesAnnot(link,r));
339  failr(PutOrderingAnnot(link,r, mv));
340
341  if (mv)
342    mp_failr(MP_PutAnnotationPacket(link,
343                                    MP_PolyDict,
344                                    MP_AnnotPolyModuleVector,
345                                    MP_AnnotRequired));
346  // Hmm .. this is not according to a "proper" Singular ring,
347  // but to be used in a recursive call of mpsr_PutRingAnnots
348  if (r->minpoly != NULL && r->parameter == NULL && r->ch > 0)
349    failr(PutMinPolyAnnot(link,r));
350 
351  if (r->qideal != NULL)
352    return PutDefRelsAnnot(link, r);
353
354  return mpsr_Success;
355}
356
357static mpsr_Status_t PutProtoTypeAnnot(MP_Link_pt link, ring r,
358                                       BOOLEAN mv)
359{
360  // each element of the poly is a
361  mp_failr(MP_PutAnnotationPacket(link,
362                                  MP_ProtoDict,
363                                  MP_AnnotProtoPrototype,
364                                  MP_AnnotReqValNode));
365  // Monom represented as a struct of 2 elements
366  mp_failr(MP_PutCommonOperatorPacket(link,
367                                      MP_ProtoDict,
368                                      MP_CopProtoStruct,
369                                      0,
370                                      2));
371
372  // First element is the coefficient
373  if ((r->ch) == 0)
374  {
375    // rational numbers
376    mp_failr(MP_PutCommonMetaTypePacket(link,
377                                        MP_NumberDict,
378                                        MP_CmtNumberRational,
379                                        1));
380    // are always normalized (and made that way, if necessary)
381    mp_failr(MP_PutAnnotationPacket(link,
382                                    MP_NumberDict,
383                                    MP_AnnotNumberIsNormalized,
384                                    0));
385  }
386  else if ((r->ch) > 1)
387  {
388    // modulo p numbers
389    // are communicated as IMP_Uint32's
390    mp_failr(MP_PutCommonMetaTypePacket(link,
391                                    MP_ProtoDict,
392                                    MP_CmtProtoIMP_Uint32,
393                                    1));
394    // but are taken as modulo numbers
395    mp_failr(MP_PutAnnotationPacket(link,
396                                    MP_NumberDict,
397                                    MP_AnnotNumberModulos,
398                                    MP_AnnotValuated));
399    // with Modulo
400    mp_failr(MP_PutUint32Packet(link, r->ch, 1));
401    if (r->parameter == NULL)
402    {
403      // which is (in our case) always a prime number
404      mp_failr(MP_PutAnnotationPacket(link,
405                                      MP_NumberDict,
406                                      MP_AnnotNumberIsPrime,
407                                      0));
408    }
409    else
410    {
411      mp_failr(MP_PutAnnotationPacket(link,
412                                      MP_SingularDict,
413                                      MP_AnnotSingularGalois,
414                                      MP_AnnotValuated));
415      mp_failr(MP_PutStringPacket(link, r->parameter[0], 0));
416    }
417  }
418  else if ((r->ch) == -1)
419  {
420    // floats
421    mp_failr(MP_PutCommonMetaTypePacket(link,
422                                    MP_ProtoDict,
423                                    MP_CmtProtoIMP_Real32,
424                                    0));
425  }
426  else
427  {
428    // alg numbers
429    // create temporary ring for describing the coeeficient domain
430    ring alg_r = (ring) Alloc0(sizeof(sip_sring));
431
432    alg_r->N = rPar(r);
433    alg_r->ch = (r->ch < 0 ? - (r->ch) : 0);
434    alg_r->order = (int *) Alloc(3*sizeof(int));
435    alg_r->order[2] = ringorder_no;
436    alg_r->order[1] = ringorder_C;
437    alg_r->order[0] = ringorder_lp;
438    alg_r->names = r->parameter;
439    alg_r->minpoly = r->minpoly;
440
441    // Algebraic numbers are
442    // a fraction of two Dense Dist Polys
443    mp_failr(MP_PutCommonMetaOperatorPacket(link,
444                                            MP_BasicDict,
445                                            MP_CopBasicDiv,
446                                            1,
447                                            0));
448    mp_failr(MP_PutAnnotationPacket(link,
449                                    MP_ProtoDict,
450                                    MP_AnnotProtoPrototype,
451                                    MP_AnnotReqValNode));
452    mp_failr(MP_PutCommonMetaOperatorPacket(link,
453                                            MP_PolyDict,
454                                            MP_CopPolyDenseDistPoly,
455                                            mpsr_GetNumOfRingAnnots(alg_r, 0),
456                                            0));
457    failr(mpsr_PutRingAnnots(link, alg_r, 0));
458
459    // destroy temporary ring
460    Free(alg_r->order, 3*sizeof(int));
461    Free(alg_r, sizeof(sip_sring));
462  }
463
464  // second element is the exponent vector
465  mp_failr(MP_PutCommonMetaOperatorPacket(link,
466                                          MP_ProtoDict,
467                                          MP_CopProtoArray,
468                                          1,
469                                          (mv ? r->N + 1 : r->N)));
470  mp_failr(MP_PutAnnotationPacket(link,
471                                  MP_ProtoDict,
472                                  MP_AnnotProtoPrototype,
473                                  MP_AnnotReqValNode));
474  mp_return(MP_PutCommonMetaTypePacket(link,
475                                   MP_ProtoDict,
476                                   MP_CmtProtoIMP_Sint32,
477                                   0));
478}
479
480   
481static mpsr_Status_t PutVarNamesAnnot(MP_Link_pt link, ring r)
482{
483  // first, we put the annot packet, with flags (1, 0, 1, 0)
484  mp_failr(MP_PutAnnotationPacket(link,
485                                  MP_PolyDict,
486                                  MP_AnnotPolyVarNames,
487                                  MP_AnnotValuated));
488  // now, the varnames follow
489  if ((r->N) == 1)
490  {
491    // only 1 varname
492    mp_return(MP_PutIdentifierPacket(link, MP_SingularDict, *(r->names), 0));
493  }
494  else
495  {
496    // more than one varname
497    char **names = r->names;
498    int i, n = r->N;
499
500    mp_failr(MP_PutCommonOperatorPacket(link,
501                                        MP_ProtoDict,
502                                        MP_CopProtoArray,
503                                        1,
504                                        r->N));
505    mp_failr(MP_PutAnnotationPacket(link,
506                                    MP_ProtoDict,
507                                    MP_AnnotProtoPrototype,
508                                    MP_AnnotReqValNode));
509                                 
510    mp_failr(MP_PutCommonMetaTypePacket(link,
511                                    MP_ProtoDict,
512                                    MP_CmtProtoIMP_Identifier,
513                                    0));
514    for (i=0; i<n; i++)
515      mp_failr(IMP_PutString(link, names[i]));
516
517    return mpsr_Success;
518  }
519}
520
521static mpsr_Status_t PutVarNumberAnnot(MP_Link_pt link, ring r, BOOLEAN mv)
522{
523  mp_failr(MP_PutAnnotationPacket(link,
524                                  MP_PolyDict,
525                                  MP_AnnotPolyVarNumber,
526                                  MP_AnnotValuated));
527  mp_return(MP_PutUint32Packet(link, (mv ? r->N + 1 : r->N), 0));
528}
529
530 
531static mpsr_Status_t PutOrderingAnnot(MP_Link_pt link, ring r, BOOLEAN mv)
532{
533  int index = 0, nblocks = 0;
534  int *order = r->order;
535
536  mp_failr(MP_PutAnnotationPacket(link,
537                                  MP_PolyDict,
538                                  MP_AnnotPolyOrdering,
539                                  MP_AnnotValuated));
540
541  // let's see whether we have a simple ordering to sent
542  if ((mv == 0) && (order[2] == ringorder_no))
543  {
544    if (order[1] == ringorder_C || order[1] == ringorder_c)
545      index = 0;
546    else
547      index = 1;
548
549    return PutSimpleOrdering(link, r, index);
550  }
551
552  // No -- so we are dealing with a product ordering
553  // First, let's find out how many blocks there are
554  while (order[nblocks] != ringorder_no) nblocks++;
555  // if we deal with a non-vector, we are not going to sent
556  // the vector ordering
557  mp_failr(MP_PutCommonOperatorPacket(link,
558                                      MP_BasicDict,
559                                      MP_CopBasicList,
560                                      0,
561                                      (mv ? nblocks : nblocks - 1)));
562
563  for (index = 0; index < nblocks; index ++)
564    // Do not sent vector ordering, if we are sending pure polys
565    if (! (mv == 0 && (order[index] == ringorder_C ||
566                       order[index] == ringorder_c)))
567    {
568      // a product ordering is sent as triple
569      mp_failr(MP_PutCommonOperatorPacket(link,
570                                          MP_BasicDict,
571                                          MP_CopBasicList,
572                                          0,
573                                          3));
574      // first element is the simple ordering
575      failr(PutSimpleOrdering(link, r, index));
576      // second and third for covered variables
577      mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) r->block0[index], 0));
578      mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) r->block1[index], 0));
579    }
580
581  return mpsr_Success;
582}
583
584
585static mpsr_Status_t PutSimpleOrdering(MP_Link_pt link, ring r, short index)
586{
587  MP_Uint32_t vlength = 0, i;
588
589  // find out the length of the weight-vector
590  if (r->wvhdl && r->wvhdl[index] != NULL)
591    vlength = r->block1[index] - r->block0[index] + 1;
592
593  mp_failr(MP_PutCommonConstantPacket(link,
594                                      MP_PolyDict,
595                                      mpsr_ord2mp(r->order[index]),
596                                      (vlength == 0 ? 0 : 1)));
597
598  if (vlength == 0) return mpsr_Success;
599
600  // deal with the weights
601  mp_failr(MP_PutAnnotationPacket(link,
602                                  MP_PolyDict,
603                                  MP_AnnotPolyWeights,
604                                  MP_AnnotValuated));
605  if (r->order[index] == ringorder_M)
606  {
607    // put the matrix header
608    mp_failr(MP_PutCommonOperatorPacket(link,
609                                        MP_MatrixDict,
610                                        MP_CopMatrixDenseMatrix,
611                                        2,
612                                        vlength*vlength));
613    mp_failr(MP_PutAnnotationPacket(link,
614                                    MP_ProtoDict,
615                                    MP_AnnotProtoPrototype,
616                                    MP_AnnotReqValNode));
617    mp_failr(MP_PutCommonMetaTypePacket(link,
618                                    MP_ProtoDict,
619                                    MP_CmtProtoIMP_Sint32,
620                                    0));
621    mp_failr(MP_PutAnnotationPacket(link,
622                                    MP_MatrixDict,
623                                    MP_AnnotMatrixDimension,
624                                    MP_AnnotReqValNode));
625    mp_failr(MP_PutCommonOperatorPacket(link,
626                                        MP_BasicDict,
627                                        MP_CopBasicList,
628                                        0, 2));
629    mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0));
630    mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0));
631    vlength *= vlength;
632  }
633  else
634  {
635    // vector header
636    mp_failr(MP_PutCommonOperatorPacket(link,
637                                        MP_MatrixDict,
638                                        MP_CopMatrixDenseVector,
639                                        1,
640                                        vlength));
641    mp_failr(MP_PutAnnotationPacket(link,
642                                    MP_ProtoDict,
643                                    MP_AnnotProtoPrototype,
644                                    MP_AnnotReqValNode));
645    mp_failr(MP_PutCommonMetaTypePacket(link,
646                                    MP_ProtoDict,
647                                    MP_CmtProtoIMP_Sint32,
648                                    0));
649  }
650
651  // weights are all what remains
652  for (i=0; i<vlength; i++)
653    mp_failr(IMP_PutSint32(link, (MP_Sint32_t) r->wvhdl[index][i]));
654
655  return mpsr_Success;
656}
657
658static mpsr_Status_t PutMinPolyAnnot(MP_Link_pt link, ring r)
659{
660  mpsr_assume(r->minpoly != NULL && r->ch > 0 && r->parameter == NULL);
661 
662  number minpoly = r->minpoly;
663  r->minpoly = 0;
664
665  mp_failr(MP_PutAnnotationPacket(link,
666                                  MP_PolyDict,
667                                  MP_AnnotPolyDefRel,
668                                  MP_AnnotValuated));
669  mp_failr(MP_PutCommonOperatorPacket(link,
670                                      MP_PolyDict,
671                                      MP_CopPolyDenseDistPoly,
672                                      5,
673                                      GetPlength( ((lnumber) minpoly)->z)));
674  failr(PutProtoTypeAnnot(link, r, 0));
675  failr(PutVarNamesAnnot(link, r));
676  failr(PutVarNumberAnnot(link, r,0));
677  failr(PutOrderingAnnot(link, r, 0));
678  mp_failr(MP_PutAnnotationPacket(link,
679                                  MP_PolyDict,
680                                  MP_AnnotPolyIrreducible,
681                                  0));
682
683  // need to set PutAlgAlgnumber and gNalgVars
684  CurrPutRing = r;
685  if (r->ch > 0)
686    PutAlgAlgNumber = PutModuloNumber;
687  else
688    PutAlgAlgNumber = PutRationalNumber;
689  gNalgvars = r->N;
690 
691  r->minpoly = minpoly;
692  return PutAlgPoly(link, ((lnumber) minpoly)->z);
693}
694
695 
696static mpsr_Status_t PutDefRelsAnnot(MP_Link_pt link, ring r)
697{
698  int i, idn;
699  ideal id;
700
701  id = r->qideal;
702  r->qideal = NULL;
703
704  mp_failr(MP_PutAnnotationPacket(link,
705                                  MP_PolyDict,
706                                  MP_AnnotPolyDefRel,
707                                  MP_AnnotValuated));
708  failr(mpsr_PutIdeal(link, id, r));
709  r->qideal = id;
710  return mpsr_Success;
711}
712
713#endif
Note: See TracBrowser for help on using the repository browser.