source: git/dyn_modules/syzextra/mod_main.cc @ 4b2e47

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