source: git/dyn_modules/syzextra/mod_main.cc @ f115489

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