source: git/dyn_modules/syzextra/mod_main.cc @ 98c972

spielwiese
Last change on this file since 98c972 was 98c972, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
added component weights to the output of GetInducedData
  • Property mode set to 100644
File size: 20.0 KB
Line 
1#include <kernel/mod2.h>
2
3#include <omalloc/omalloc.h>
4
5#include <misc/intvec.h>
6
7#include <coeffs/coeffs.h>
8
9#include <polys/monomials/p_polys.h>
10#include <polys/monomials/ring.h>
11// #include <kernel/longrat.h>
12#include <kernel/kstd1.h>
13
14#include <kernel/polys.h>
15
16#include <kernel/syz.h>
17
18#include <Singular/tok.h>
19#include <Singular/ipid.h>
20#include <Singular/lists.h>
21#include <Singular/attrib.h>
22
23#include <Singular/ipid.h> 
24// extern coeffs coeffs_BIGINT
25
26#include "singularxx_defs.h"
27#include "DebugPrint.h"
28#include "myNF.h"
29
30extern BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p, const intvec * componentWeights);
31
32// extern void rSetISReference(const ideal F, const int rank, const int p, const intvec * componentWeights, const ring r);
33extern void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r);
34// extern ring rCurrRingAssure_SyzComp();
35extern ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sign);
36extern int rGetISPos(const int p, const ring r);
37
38
39USING_NAMESPACE( SINGULARXXNAME :: DEBUG )
40USING_NAMESPACE( SINGULARXXNAME :: NF )
41
42BEGIN_NAMESPACE_NONAME
43static inline void NoReturn(leftv& res)
44{
45  res->rtyp = NONE;
46  res->data = NULL;
47}
48
49/// try to get an optional (simple) integer argument out of h
50/// or return the default value
51static int getOptionalInteger(const leftv& h, const int _n)
52{
53  if( h!= NULL && h->Typ() == INT_CMD )
54  {
55    int n = (int)(long)(h->Data());
56
57    if( n < 0 )
58      Warn("Negative (%d) optional integer argument", n);
59
60    return (n);
61  }
62
63  return (_n); 
64}
65
66BOOLEAN noop(leftv __res, leftv /*__v*/)
67{
68  NoReturn(__res);
69  return FALSE;
70}
71
72
73static inline number jjLONG2N(long d)
74{
75  return n_Init(d, coeffs_BIGINT);
76}
77
78static inline void view(const intvec* v)
79{
80#ifndef NDEBUG
81  v->view();
82#else
83  // This code duplication is only due to Hannes's #ifndef NDEBUG!
84  Print ("intvec: {rows: %d, cols: %d, length: %d, Values: \n", v->rows(), v->cols(), v->length());
85
86  for (int i = 0; i < v->rows(); i++)
87  {
88    Print ("Row[%3d]:", i);
89    for (int j = 0; j < v->cols(); j++)
90      Print (" %5d", (*v)[j + i * (v->cols())] );
91    PrintLn ();
92  }
93  PrintS ("}\n");
94#endif
95
96}
97
98                   
99
100static BOOLEAN DetailedPrint(leftv __res, leftv h)
101{
102  NoReturn(__res);
103
104  if( h == NULL )
105  {
106    WarnS("DetailedPrint needs an argument...");
107    return TRUE;
108  }
109
110  if( h->Typ() == RING_CMD)
111  {
112    const ring r = (const ring)h->Data();
113    rWrite(r);
114    PrintLn();
115#ifdef RDEBUG
116    rDebugPrint(r);
117#endif
118    return FALSE;
119  }
120
121  if( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD)
122  {
123    const poly p = (const poly)h->Data(); h = h->Next();
124
125    dPrint(p, currRing, currRing, getOptionalInteger(h, 3));
126
127    return FALSE;
128  }
129
130  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
131  {
132    const ideal id = (const ideal)h->Data(); h = h->Next(); 
133
134    dPrint(id, currRing, currRing, getOptionalInteger(h, 3));
135   
136    return FALSE;           
137  }
138
139  if( h->Typ() == RESOLUTION_CMD )
140  {
141    const syStrategy syzstr = reinterpret_cast<const syStrategy>(h->Data());
142
143    h = h->Next();
144
145    int nTerms = getOptionalInteger(h, 1);
146
147
148    Print("RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr)); PrintLn();
149
150    const ring save = currRing;
151    const ring r = syzstr->syRing;
152    const ring rr = (r != NULL) ? r: save;
153
154
155    const int iLength = syzstr->length;
156
157    Print("int 'length': %d", iLength); PrintLn();
158    Print("int 'regularity': %d", syzstr->regularity); PrintLn();
159    Print("short 'list_length': %hd", syzstr->list_length); PrintLn();
160    Print("short 'references': %hd", syzstr->references); PrintLn();
161
162
163#define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \
164if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \
165PrintLn();
166
167    PRINT_pINTVECTOR(syzstr, resolution);
168    PRINT_pINTVECTOR(syzstr, betti);
169    PRINT_pINTVECTOR(syzstr, Tl);
170    PRINT_pINTVECTOR(syzstr, cw);
171#undef PRINT_pINTVECTOR
172
173    if (r == NULL)
174      Print("ring '%10s': NULL", "syRing");
175    else 
176      if (r == currRing)
177        Print("ring '%10s': currRing", "syRing");
178      else
179        if (r != NULL && r != save)
180        {
181          Print("ring '%10s': ", "syRing");
182          rWrite(r);
183#ifdef RDEBUG
184          //              rDebugPrint(r);
185#endif
186          // rChangeCurrRing(r);
187        }           
188    PrintLn();
189
190    const SRes rP = syzstr->resPairs;
191    Print("SRes 'resPairs': %p", reinterpret_cast<const void*>(rP)); PrintLn();
192
193    if (rP != NULL)
194      for (int iLevel = 0; (iLevel < iLength) && (rP[iLevel] != NULL) && ((*syzstr->Tl)[iLevel] >= 0); iLevel++)
195      {
196        int n = 0;
197        const int iTl = (*syzstr->Tl)[iLevel];
198        for (int j = 0; (j < iTl) && ((rP[iLevel][j].lcm!=NULL) || (rP[iLevel][j].syz!=NULL)); j++)
199        {
200          if (rP[iLevel][j].isNotMinimal==NULL)
201            n++;
202        }
203        Print("minimal-resPairs-Size[1+%d]: %d", iLevel, n); PrintLn();
204      }
205
206
207    //  const ring rrr = (iLevel > 0) ? rr : save; ?
208#define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \
209if ((s)->v != NULL) \
210  for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \
211  { \
212    /* const ring rrr = (iLevel > 0) ? save : save; */ \
213    Print("id '%10s'[%d]: (%p) ncols = %d / size: %d; nrows = %d, rank = %ld / rk: %ld", #v, iLevel, reinterpret_cast<const void*>(((s)->v)[iLevel]), ((s)->v)[iLevel]->ncols, idSize(((s)->v)[iLevel]), ((s)->v)[iLevel]->nrows, ((s)->v)[iLevel]->rank, -1L/*id_RankFreeModule(((s)->v)[iLevel], rrr)*/ ); \
214    PrintLn(); \
215  } \
216  PrintLn();
217
218    // resolvente:
219    PRINT_RESOLUTION(syzstr, minres);
220    PRINT_RESOLUTION(syzstr, fullres);
221
222    assume (id_RankFreeModule (syzstr->res[1], rr) == syzstr->res[1]->rank);
223
224    PRINT_RESOLUTION(syzstr, res);
225    PRINT_RESOLUTION(syzstr, orderedRes);
226#undef PRINT_RESOLUTION
227
228#define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();
229    // 2d arrays:
230    PRINT_POINTER(syzstr, truecomponents);
231    PRINT_POINTER(syzstr, ShiftedComponents);
232    PRINT_POINTER(syzstr, backcomponents);
233    PRINT_POINTER(syzstr, Howmuch);
234    PRINT_POINTER(syzstr, Firstelem);
235    PRINT_POINTER(syzstr, elemLength);
236    PRINT_POINTER(syzstr, sev);
237
238    // arrays of intvects:
239    PRINT_POINTER(syzstr, weights);
240    PRINT_POINTER(syzstr, hilb_coeffs);
241#undef PRINT_POINTER
242
243
244    if (syzstr->fullres==NULL)
245    {
246      PrintS("resolution 'fullres': (NULL) => resolution not computed yet");
247      PrintLn();
248    } else
249    {
250      Print("resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->fullres));
251      PrintLn();
252      dPrint(*syzstr->fullres, save, save, nTerms);
253    }
254
255
256
257
258    if (syzstr->minres==NULL)
259    {
260      PrintS("resolution 'minres': (NULL) => resolution not minimized yet");
261      PrintLn();
262    } else
263    {
264      Print("resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->minres));
265      PrintLn();
266      dPrint(*syzstr->minres, save, save, nTerms);
267    }
268
269
270
271
272    /*
273    int ** truecomponents;
274    long** ShiftedComponents;
275    int ** backcomponents;
276    int ** Howmuch;
277    int ** Firstelem;
278    int ** elemLength;
279    unsigned long ** sev;
280
281    intvec ** weights;
282    intvec ** hilb_coeffs;
283
284    SRes resPairs;               //polynomial data for internal use only
285
286    resolvente fullres;
287    resolvente minres;
288    resolvente res;              //polynomial data for internal use only
289    resolvente orderedRes;       //polynomial data for internal use only
290*/
291
292    //            if( currRing != save ) rChangeCurrRing(save);
293  }
294
295
296  return FALSE;
297}
298
299
300
301/// Get leading monom (no module component)
302static BOOLEAN leadmonom(leftv res, leftv h)
303{
304  NoReturn(res);
305
306  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))
307  {
308    const ring r = currRing;
309    const poly p = (poly)(h->Data());
310
311    poly m = NULL;
312
313    if( p != NULL )
314    {
315      assume( p != NULL );
316      assume( p_LmTest(p, r) );
317
318      m = p_LmInit(p, r);
319      p_SetCoeff0(m, n_Init(1, r), r);
320
321      //            if( p_GetComp(m, r) != 0 )
322      //            {
323      p_SetComp(m, 0, r);
324      p_Setm(m, r);
325      //            }
326
327      assume( p_GetComp(m, r) == 0 );
328      assume( m != NULL );
329      assume( p_LmTest(m, r) );
330    }
331
332    res->rtyp = POLY_CMD;
333    res->data = reinterpret_cast<void *>(m);
334
335    return FALSE;
336  }
337
338  WerrorS("`leadmonom(<poly/vector>)` expected");
339  return TRUE;
340}
341
342/// Get leading component
343static BOOLEAN leadcomp(leftv res, leftv h)
344{
345  NoReturn(res);
346
347  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))
348  {
349    const ring r = currRing;
350
351    const poly p = (poly)(h->Data());
352
353    assume( p != NULL );
354    assume( p_LmTest(p, r) );
355
356    const unsigned long iComp = p_GetComp(p, r);
357
358    assume( iComp > 0 ); // p is a vector
359
360    res->rtyp = BIGINT_CMD;
361    res->data = reinterpret_cast<void *>(jjLONG2N(iComp));
362
363    return FALSE;
364  }
365
366  WerrorS("`leadcomp(<poly/vector>)` expected");
367  return TRUE;
368}
369
370
371
372
373/// Get raw leading exponent vector
374static BOOLEAN leadrawexp(leftv res, leftv h)
375{
376  NoReturn(res);
377
378  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))
379  {
380    const ring r = currRing;
381    const poly p = (poly)(h->Data());
382
383    assume( p != NULL );
384    assume( p_LmTest(p, r) );
385
386    const int iExpSize = r->ExpL_Size;
387
388//    intvec *iv = new intvec(iExpSize);
389
390    lists l=(lists)omAllocBin(slists_bin);
391    l->Init(iExpSize);
392
393    for(int i = iExpSize-1; i >= 0; i--)
394    {
395      l->m[i].rtyp = BIGINT_CMD;
396      l->m[i].data = reinterpret_cast<void *>(jjLONG2N(p->exp[i])); // longs...
397    }
398
399    res->rtyp = LIST_CMD; // list of bigints
400    res->data = reinterpret_cast<void *>(l);
401    return FALSE;
402  }
403
404  WerrorS("`leadrawexp(<poly/vector>)` expected");
405  return TRUE;
406}
407
408
409/// Endowe the current ring with additional (leading) Syz-component ordering
410static BOOLEAN MakeSyzCompOrdering(leftv res, leftv /*h*/)
411{
412
413  NoReturn(res);
414
415  //    res->data = rCurrRingAssure_SyzComp(); // changes current ring! :(
416  res->data = reinterpret_cast<void *>(rAssure_SyzComp(currRing, TRUE));
417  res->rtyp = RING_CMD; // return new ring!
418  // QRING_CMD?
419
420  return FALSE;
421}
422
423
424/// Same for Induced Schreyer ordering (ordering on components is defined by sign!)
425static BOOLEAN MakeInducedSchreyerOrdering(leftv res, leftv h)
426{
427
428  NoReturn(res);
429
430  int sign = 1;
431  if ((h!=NULL) && (h->Typ()==INT_CMD))
432  {
433    const int s = (int)((long)(h->Data()));
434
435    if( s != -1 && s != 1 )
436    {
437      WerrorS("`MakeInducedSchreyerOrdering(<int>)` called with wrong integer argument (must be +-1)!");
438      return TRUE;
439    }
440
441    sign = s;           
442  }
443
444  assume( sign == 1 || sign == -1 );
445  res->data = reinterpret_cast<void *>(rAssure_InducedSchreyerOrdering(currRing, TRUE, sign));
446  res->rtyp = RING_CMD; // return new ring!
447  // QRING_CMD?
448  return FALSE;
449}
450
451
452/// Returns old SyzCompLimit, can set new limit
453static BOOLEAN SetSyzComp(leftv res, leftv h)
454{
455  NoReturn(res);
456
457  const ring r = currRing;
458
459  if( !rIsSyzIndexRing(r) )
460  {
461    WerrorS("`SetSyzComp(<int>)` called on incompatible ring (not created by 'MakeSyzCompOrdering'!)");
462    return TRUE;
463  }
464
465  res->rtyp = INT_CMD;
466  res->data = reinterpret_cast<void *>(rGetCurrSyzLimit(r)); // return old syz limit
467
468  if ((h!=NULL) && (h->Typ()==INT_CMD))
469  {
470    const int iSyzComp = (int)reinterpret_cast<long>(h->Data());
471    assume( iSyzComp > 0 );
472    rSetSyzComp(iSyzComp, currRing);
473  }
474
475  return FALSE;
476}
477
478/// ?
479static BOOLEAN GetInducedData(leftv res, leftv h)
480{
481  NoReturn(res);
482
483  const ring r = currRing;
484
485  int p = 0; // which IS-block? p^th!
486
487  if ((h!=NULL) && (h->Typ()==INT_CMD))
488  {
489    p = (int)((long)(h->Data())); h=h->next;
490    assume(p >= 0);
491  }
492
493  const int pos = rGetISPos(p, r);
494
495  if( (-1 == pos) )
496  {
497    WerrorS("`GetInducedData([int])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
498    return TRUE;
499  }
500
501
502  const int iLimit = r->typ[pos].data.is.limit;
503  const ideal F = r->typ[pos].data.is.F;
504  const intvec* componentWeights = r->typ[pos].data.is.componentWeights;
505  ideal FF = id_Copy(F, r);
506
507  lists l=(lists)omAllocBin(slists_bin);
508  l->Init(3);
509
510  l->m[0].rtyp = INT_CMD;
511  l->m[0].data = reinterpret_cast<void *>(iLimit);
512
513
514  //        l->m[1].rtyp = MODUL_CMD;
515
516  if( idIsModule(FF, r) )
517  {
518    l->m[1].rtyp = MODUL_CMD;
519
520    //          Print("before: %d\n", FF->nrows);
521    //          FF->nrows = id_RankFreeModule(FF, r); // ???
522    //          Print("after: %d\n", FF->nrows);
523  }
524  else
525    l->m[1].rtyp = IDEAL_CMD;
526
527  l->m[1].data = reinterpret_cast<void *>(FF);
528
529  l->m[2].rtyp = INTVEC_CMD;
530 
531  if( componentWeights != NULL )
532    l->m[2].data = reinterpret_cast<void *>(new intvec(componentWeights));
533  else
534    l->m[2].data = reinterpret_cast<void *>(new intvec());
535   
536
537
538  res->rtyp = LIST_CMD; // list of int/module
539  res->data = reinterpret_cast<void *>(l);
540
541  return FALSE;
542
543}
544
545
546/// Returns old SyzCompLimit, can set new limit
547static BOOLEAN SetInducedReferrence(leftv res, leftv h)
548{
549  NoReturn(res);
550
551  const ring r = currRing;
552
553  if( !( (h!=NULL) && ( (h->Typ()==IDEAL_CMD) || (h->Typ()==MODUL_CMD))) )
554  {
555    WerrorS("`SetInducedReferrence(<ideal/module>, [int[, int]])` expected");
556    return TRUE;
557  }
558
559  intvec * componentWeights = (intvec *)atGet(h,"isHomog",INTVEC_CMD); // No copy!
560
561  const ideal F = (ideal)h->Data(); ; // No copy!
562  h=h->next;
563
564  int rank = 0;
565
566  if ((h!=NULL) && (h->Typ()==INT_CMD))
567  {
568    rank = (int)((long)(h->Data())); h=h->next;
569    assume(rank >= 0);
570  } else
571    rank = id_RankFreeModule(F, r); // Starting syz-comp (1st: i+1)
572
573  int p = 0; // which IS-block? p^th!
574
575  if ((h!=NULL) && (h->Typ()==INT_CMD))
576  {
577    p = (int)((long)(h->Data())); h=h->next;
578    assume(p >= 0);
579  }
580
581  const int posIS = rGetISPos(p, r);
582
583  if( (-1 == posIS) )
584  {
585    WerrorS("`SetInducedReferrence(<ideal/module>, [int[, int]])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
586    return TRUE;
587  }
588
589
590
591  // F & componentWeights belong to that ordering block of currRing now:
592  rSetISReference(r, F, rank, p, componentWeights); // F and componentWeights will be copied!
593  return FALSE;
594}
595
596
597//    F = ISUpdateComponents( F, V, MIN );
598//    // replace gen(i) -> gen(MIN + V[i-MIN]) for all i > MIN in all terms from F!
599static BOOLEAN ISUpdateComponents(leftv res, leftv h)
600{
601  NoReturn(res);
602
603  PrintS("ISUpdateComponents:.... \n");
604
605  if ((h!=NULL) && (h->Typ()==MODUL_CMD))
606  {
607    ideal F = (ideal)h->Data(); ; // No copy!
608    h=h->next;
609
610    if ((h!=NULL) && (h->Typ()==INTVEC_CMD))
611    {
612      const intvec* const V = (const intvec* const) h->Data();
613      h=h->next;
614
615      if ((h!=NULL) && (h->Typ()==INT_CMD))
616      {
617        const int MIN = (int)((long)(h->Data()));
618
619        pISUpdateComponents(F, V, MIN, currRing);
620        return FALSE;
621      }
622    }
623  }
624
625  WerrorS("`ISUpdateComponents(<module>, intvec, int)` expected");
626  return TRUE;
627}
628
629
630/// NF using length
631static BOOLEAN reduce_syz(leftv res, leftv h)
632{
633  const ring r = currRing;
634
635  if ( !( (h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) ) )
636  {
637    WerrorS("`reduce_syz(<poly/vector>!, <ideal/module>, <int>, [int])` expected");
638    return TRUE;
639  }
640
641  res->rtyp = h->Typ();
642  const poly v = reinterpret_cast<poly>(h->Data());
643  h=h->next;
644
645  if ( !( (h!=NULL) && (h->Typ()==MODUL_CMD || h->Typ()==IDEAL_CMD ) ) )
646  {
647    WerrorS("`reduce_syz(<poly/vector>, <ideal/module>!, <int>, [int])` expected");
648    return TRUE;
649  }
650
651  assumeStdFlag(h);
652  const ideal M = reinterpret_cast<ideal>(h->Data()); h=h->next;
653
654
655  if ( !( (h!=NULL) && (h->Typ()== INT_CMD)  ) )
656  {
657    WerrorS("`reduce_syz(<poly/vector>, <ideal/module>, <int>!, [int])` expected");
658    return TRUE;
659  }
660
661  const int iSyzComp = (int)((long)(h->Data())); h=h->next;
662
663  int iLazyReduce = 0;
664
665  if ( ( (h!=NULL) && (h->Typ()== INT_CMD)  ) )
666    iLazyReduce = (int)((long)(h->Data())); 
667
668  res->data = (void *)kNFLength(M, currQuotient, v, iSyzComp, iLazyReduce);
669  return FALSE;
670}
671
672
673/// Get raw syzygies (idPrepare)
674static BOOLEAN idPrepare(leftv res, leftv h)
675{
676  //        extern int rGetISPos(const int p, const ring r);
677
678  const ring r = currRing;
679
680  const bool isSyz = rIsSyzIndexRing(r);
681  const int posIS = rGetISPos(0, r);
682
683  if( (!isSyz) && (-1 == posIS) )
684  {
685    WerrorS("`idPrepare(<...>)` called on incompatible ring (not created by 'MakeSyzCompOrdering' or 'MakeInducedSchreyerOrdering'!)");
686    return TRUE;
687  }
688
689  if ( !( (h!=NULL) && (h->Typ()==MODUL_CMD) && (h->Data() != NULL) ) )
690  {
691    WerrorS("`idPrepare(<module>)` expected");
692    return TRUE;
693  }
694
695  const ideal I = reinterpret_cast<ideal>(h->Data());
696
697  assume( I != NULL );
698  idTest(I);
699
700  int iComp = -1;
701
702  h=h->next;
703  if ( (h!=NULL) && (h->Typ()==INT_CMD) )
704  {
705    iComp = (int)((long)(h->Data()));
706  } else
707  {
708    if( isSyz )
709      iComp = rGetCurrSyzLimit(r);
710    else
711      iComp = id_RankFreeModule(r->typ[posIS].data.is.F, r); // ;
712  }
713
714
715  tHomog hom=testHomog;
716  intvec *w; //  = reinterpret_cast<intvec *>(atGet(h, "isHomog", INTVEC_CMD));
717
718  //           int add_row_shift = 0;
719  //
720  //           if (w!=NULL)
721  //           {
722  //             intvec * ww = ivCopy(w);
723  //
724  //             add_row_shift = ww->min_in();
725  //
726  //             (*ww) -= add_row_shift;
727  //             
728  //             if (idTestHomModule(I, currQuotient, ww))
729  //             {
730  //               hom = isHomog;
731  //               w = ww;
732  //             }
733  //             else
734  //             {
735  //               //WarnS("wrong weights");
736  //               delete ww;
737  //               w = NULL;
738  //               hom=testHomog;
739  //             }
740  //           }
741
742
743  // computes syzygies of h1,
744  // works always in a ring with ringorder_s
745  // NOTE: rSetSyzComp(syzcomp) should better be called beforehand
746  //        ideal idPrepare (ideal  h1, tHomog hom, int syzcomp, intvec **w);
747
748  ideal J = // idPrepare( I, hom, iComp, &w);
749           kStd(I, currQuotient, hom, &w, NULL, iComp);
750
751  idTest(J);
752
753  if (w!=NULL) delete w;
754  //          if (w!=NULL)
755  //            atSet(res, omStrDup("isHomog"), w, INTVEC_CMD);
756
757  res->rtyp = MODUL_CMD;
758  res->data = reinterpret_cast<void *>(J);
759  return FALSE;
760}
761
762/// Get raw syzygies (idPrepare)
763static BOOLEAN _p_Content(leftv res, leftv h)
764{
765  if ( !( (h!=NULL) && (h->Typ()==POLY_CMD) && (h->Data() != NULL) ) )
766  {
767    WerrorS("`p_Content(<poly-var>)` expected");
768    return TRUE;
769  }
770
771
772  const poly p = reinterpret_cast<poly>(h->Data());
773
774 
775  pTest(p);  pWrite(p); PrintLn();
776
777 
778  p_Content( p, currRing);     
779
780  pTest(p);
781  pWrite(p); PrintLn();
782 
783  NoReturn(res);
784}
785
786END_NAMESPACE
787
788extern "C"
789{
790
791int mod_init(SModulFunctions* psModulFunctions) 
792{
793 
794  psModulFunctions->iiAddCproc(currPack->libname,(char*)"DetailedPrint",FALSE, DetailedPrint);
795  psModulFunctions->iiAddCproc(currPack->libname,(char*)"leadmonom",FALSE, leadmonom);
796  psModulFunctions->iiAddCproc(currPack->libname,(char*)"leadcomp",FALSE, leadcomp);
797  psModulFunctions->iiAddCproc(currPack->libname,(char*)"leadrawexp",FALSE, leadrawexp);
798
799
800  psModulFunctions->iiAddCproc(currPack->libname,(char*)"ISUpdateComponents",FALSE, ISUpdateComponents);
801  psModulFunctions->iiAddCproc(currPack->libname,(char*)"SetInducedReferrence",FALSE, SetInducedReferrence);
802  psModulFunctions->iiAddCproc(currPack->libname,(char*)"GetInducedData",FALSE, GetInducedData);
803  psModulFunctions->iiAddCproc(currPack->libname,(char*)"SetSyzComp",FALSE, SetSyzComp);
804  psModulFunctions->iiAddCproc(currPack->libname,(char*)"MakeInducedSchreyerOrdering",FALSE, MakeInducedSchreyerOrdering);
805  psModulFunctions->iiAddCproc(currPack->libname,(char*)"MakeSyzCompOrdering",FALSE, MakeSyzCompOrdering);
806 
807  psModulFunctions->iiAddCproc(currPack->libname,(char*)"noop",FALSE, noop);
808 
809  psModulFunctions->iiAddCproc(currPack->libname,(char*)"idPrepare",FALSE, idPrepare);
810  psModulFunctions->iiAddCproc(currPack->libname,(char*)"reduce_syz",FALSE, reduce_syz);
811
812  psModulFunctions->iiAddCproc(currPack->libname,(char*)"p_Content",FALSE, _p_Content);
813
814  //  psModulFunctions->iiAddCproc(currPack->libname,(char*)"",FALSE, );
815 
816  return 0;
817}
818}
Note: See TracBrowser for help on using the repository browser.