source: git/Singular/LIB/schreyer.lib @ 74afe1f

spielwiese
Last change on this file since 74afe1f was 74afe1f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
moved 'Compute2LeadingSyzygyTerms' into the dyn.mod. TODO/TEST: interred & tailred
  • Property mode set to 100644
File size: 35.0 KB
Line 
1///////////////////////////////////////////////////////////////////////////
2version="version schreyer.lib 4.0.0.0 Jun_2013 "; // $Id$
3category="General purpose";
4info="
5LIBRARY: schreyer.lib     Helpers for computing a Schreyer resolution in @code{derham.lib}
6AUTHOR:  Oleksandr Motsak <U@D>, where U={motsak}, D={mathematik.uni-kl.de}
7KEYWORDS: Schreyer ordering; Schreyer resolution; syzygy
8OVERVIEW:
9@* The library contains helper procedures for computing a Schreyer resoltion (cf. [SFO]),
10   originally meant to be used by @code{derham.lib} (which requires resolutions over the homogenized Weyl algebra).
11   The library works both in the commutative and non-commutative setting (cf. [MO]).
12   Here, we call a free resolution a Schreyer resolution if each syzygy module is given by a Groebner basis
13   with respect to the corresponding Schreyer ordering.
14   A Schreyer resolution can be much bigger than a minimal resolution of the same module, but may be easier to construct.
15@* The input for the resolution computations is a set of vectors @code{M} in form of a module over some basering @code{R}.
16   The ring @code{R} may be non-commutative, in which case the ring ordering should be global.
17@* These procedures produce/work with partial Schreyer resolutions of @code{(R^rank(M))/M} in form of
18   a ring (endowed with a special ring ordering that will be extended in the course of a resolution computation)
19   containing a list of modules @code{RES} and a module @code{MRES}:
20@* The list of modules @code{RES} contains the images of maps (also called syzygy modules) substituting the
21   computed beginning of a Schreyer resolution, that is, each syzygy module is given by a Groebner basis
22   with respect to the corresponding Schreyer ordering.
23@* The list @code{RES} starts with a zero map given by @code{rank(M)} zero generators indicating that the image of
24   the first differential map is zero. The second map @code{RES[2]} is given by @code{M}, which indicates that
25   the resolution of @code{(R^rank(M))/M} is being computed.
26@* The module @code{MRES} is a direct sum of modules from @code{RES} and thus comprises all computed differentials.
27@* Syzygies are shifted so that @code{gen(i)} is mapped to @code{MRES[i]} under the differential map.
28@* The Schreyer ordering succesively extends the starting module ordering on @code{M} (defined in Singular by the basering @code{R})
29   and is extended to higher syzygies using the following definition:
30@*        a < b if and only if (d(a) < d(b)) OR ( (d(a) = d(b) AND (comp(a) < comp(b)) ),
31@* where @code{d(a)} is the image of a under the differential (given by @code{MRES}),
32   and @code{comp(a)} is the module component, for any module terms @code{a} and @code{b} from the same higher syzygy module.
33REFERENCES:
34[SFO] Schreyer, F.O.: Die Berechnung von Syzygien mit dem verallgemeinerten Weierstrassschen Divisionssatz,
35      Master's thesis, Univ. Hamburg, 1980.
36[MO]  Motsak, O.: Non-commutative Computer Algebra with applications: Graded commutative algebra and related
37      structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010
38
39NOTE:  requires the dynamic or built-in module @code{syzextra}
40
41PROCEDURES:
42  Sres(M,len)     compute Schreyer resolution of module M of maximal length len
43  Ssyz(M)         compute Schreyer resolution of module M of length 1
44  Scontinue(len)  extend currently active resolution by (at most) len syszygies
45";
46
47static proc prepareSyz( module I, list # )
48{
49  int i;
50  int k = 0;
51  int r = nrows(I);
52  int c = ncols(I);
53
54
55  if( size(#) > 0 )
56  {
57    if( typeof(#[1]) == "int" || typeof(#[1]) == "bigint" )
58    {
59      k = #[1];
60    }
61  }
62
63  if( k < r )
64  {
65    "// *** Wrong k: ", k, " < nrows: ", r, " => setting k = r = ", r;
66    k = r;
67  }
68
69//   "k: ", k;  "c: ", c;   "I: ", I;
70
71  for( i = c; i > 0; i-- )
72  {
73    I[i] = I[i] + gen(k + i);
74  }
75
76//  DetailedPrint(I);
77
78  return(I);
79}
80
81static proc separateSyzGB( module J, int c )
82{
83  module II, G; vector v; int i;
84
85  J = simplify(J, 2);
86
87  for( i = ncols(J); i > 0; i-- )
88  {
89    v = J[i];
90    if( leadcomp(v) > c )
91    {
92      II[i] = v;
93    } else
94    {
95      G[i] = v; // leave only gen(i): i <= c
96    }
97  }
98
99  II = simplify(II, 2);
100  G = simplify(G, 2);
101
102  return (list(G, II));
103}
104
105static proc splitSyzGB( module J, int c )
106{
107  module JJ; vector v, vv; int i;
108
109  for( i = ncols(J); i > 0; i-- )
110  {
111    v = J[i];
112
113    vv = 0;
114   
115    while( leadcomp(v) <= c )
116    {
117      vv = vv + lead(v);
118      v  = v  - lead(v);
119    }
120
121    J[i] = vv;
122    JJ[i] = v;
123  }
124
125  J = simplify(J, 2);
126  JJ = simplify(JJ, 2);
127
128  return (list(J, JJ));
129}
130
131
132static proc Sinit(module M)
133{
134  def @save = basering;
135 
136  int @DEBUG = !system("with", "ndebug");
137  if( @DEBUG )
138  {
139    "Sinit::Input";
140    type(M);
141    DetailedPrint(M);
142    attrib(M);
143  }
144
145  int @RANK = nrows(M); int @SIZE = ncols(M);
146
147  int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
148
149  if( !@IS_A_SB )
150  {
151    M = std(M); // this should be faster than computing std in S (later on)
152  }
153
154  def S = MakeInducedSchreyerOrdering(1); // 1 puts history terms to the back
155  // TODO: NOTE: +1 causes trouble to Singular interpreter!!!???
156  setring S; // a new ring with a Schreyer ordering
157
158  if( @DEBUG )
159  {
160    "Sinit::StartingISRing";
161    basering;
162//    DetailedPrint(basering);
163  }
164
165  // Setup the leading syzygy^{-1} module to zero:
166  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
167
168  module MRES = Z;
169 
170  list RES; RES[1] = Z;
171
172  module F = freemodule(@RANK);
173  intvec @V = deg(F[1..@RANK]);
174 
175  module M = imap(@save, M);
176 
177  attrib(M, "isHomog", @V);
178  attrib(M, "isSB", 1);
179
180 
181  if( @DEBUG )
182  {
183    "Sinit::SB_Input: ";
184    type(M);
185    attrib(M);
186    attrib(M, "isHomog");
187    DetailedPrint(M);
188  }
189
190  if( @DEBUG )
191  {
192    // 0^th syz. property
193    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
194    {
195      transpose( transpose(M) * transpose(MRES) );
196      "transpose( transpose(M) * transpose(MRES) ) != 0!!!";
197      $
198    }
199  }
200
201  RES[size(RES)+1] = M; // list of all syzygy modules
202  MRES = MRES, M;
203
204  attrib(MRES, "isHomog", @V); 
205
206  attrib(S, "InducionLeads", lead(M));
207  attrib(S, "InducionStart", @RANK); 
208 
209  if( @DEBUG )
210  {
211    "Sinit::MRES";
212    DetailedPrint(MRES);
213    attrib(MRES, "isHomog");
214    attrib(S);
215  }
216
217  export RES;
218  export MRES;
219  return (S);
220}
221
222static proc Sstep()
223{
224  int @DEBUG = !system("with", "ndebug");
225
226  if( @DEBUG )
227  {
228    "Sstep::NextInducedRing";
229    DetailedPrint(basering);
230
231    attrib(basering, "InducionLeads");
232    attrib(basering, "InducionStart");
233
234    GetInducedData();
235  }
236
237  // syzygy step:
238
239/*
240  // is initial weights are all zeroes!
241  def L =  lead(M);
242  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
243  SetInducedReferrence(L, @RANK, 0);
244*/
245
246//  def L =  lead(MRES);
247//  @W = @W, @V;
248//  attrib(L, "isHomog", @W); 
249
250
251  // General setting:
252//  SetInducedReferrence(MRES, 0, 0); // limit: 0!
253  int @l = size(RES);
254
255  module M = RES[@l];
256
257  module L = attrib(basering, "InducionLeads");
258  int limit = attrib(basering, "InducionStart");
259
260//  L;  limit;
261 
262  int @RANK = ncols(MRES) - ncols(M); // nrows(M); // what if M is zero?!
263
264/*
265  if( @RANK !=  nrows(M) )
266  {
267    type(MRES);
268    @RANK;
269    type(M);
270    pause();
271  }
272*/
273 
274  intvec @W = attrib(M, "isHomog");
275  intvec @V = deg(M[1..ncols(M)]);
276  @V = @W, @V;
277   
278  if( @DEBUG )
279  {
280    "Sstep::NextInput: ";
281    M;
282    deg(M[1..ncols(M)]); // no use of @W :(?
283    @RANK;   
284    DetailedPrint(MRES);
285    attrib(MRES, "isHomog"); @W;
286    deg(MRES[1..ncols(MRES)]);
287  }
288
289 
290     
291  SetInducedReferrence(L, limit, 0);
292 
293  def K = prepareSyz(M, @RANK);
294//  K;
295 
296//   attrib(K, "isHomog", @V);   DetailedPrint(K, 1000);
297
298//  pause();
299 
300  K = idPrepare(K, @RANK); // std(K); // ?
301  K = simplify(K, 2);
302
303//  K;
304
305  module N = separateSyzGB(K, @RANK)[2]; // 1^st syz. module: vectors which start in lower part (comp >= @RANK)
306
307// "N_0: "; N; DetailedPrint(N, 10);
308
309//  basering; print(@V); type(N);
310//  attrib(N, "isHomog", @V);  // TODO: fix "wrong weights"!!!? deg is wrong :(((
311  N = std(N);
312  attrib(N, "isHomog", @V);
313
314//  N;
315 
316  if( @DEBUG )
317  {
318    if( size(N) > 0 )
319    {
320      // next syz. property
321      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
322      {
323        MRES;
324
325        "N: "; N; DetailedPrint(N, 10);
326
327        "K:"; K; DetailedPrint(K, 10);
328
329        "RANKS: ", @RANK;
330
331        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
332        transpose( transpose(N) * transpose(MRES) );
333
334        "transpose(N) * transpose(MRES): ";
335        transpose(N) * transpose(MRES);
336        DetailedPrint(module(_), 2);
337        $
338      }
339    }
340  }
341 
342  RES[@l + 1] = N; // list of all syzygy modules
343 
344  MRES = MRES, N;
345  attrib(MRES, "isHomog", @V);
346
347
348  L = L, lead(N);
349  attrib(basering, "InducionLeads", L);
350
351  if( @DEBUG )
352  {
353    "Sstep::NextSyzOutput: ";
354    DetailedPrint(N);
355    attrib(N, "isHomog");
356  }
357
358}
359
360proc Scontinue(int l)
361"USAGE:  Scontinue(int len)
362RETURN:  nothing, instead it changes the currently active resolution
363PURPOSE: extends the currently active resolution by at most len syzygies
364ASSUME:  must be used within a ring returned by Sres or Ssyz
365EXAMPLE: example Scontinue; shows an example
366"
367{
368  def data = GetInducedData();
369           
370  if( (!defined(RES)) || (!defined(MRES)) || (typeof(data) != "list") || (size(data) != 2) )
371  {
372    ERROR("Sorry, but basering does not seem to be returned by Sres or Ssyz");
373  }
374  for (;  (l != 0) && (size(RES[size(RES)]) > 0); l-- )
375  {
376    Sstep();
377  }
378}
379example
380{ "EXAMPLE:"; echo = 2;
381  ring r;
382  module M = maxideal(1); M;
383  def S = Ssyz(M); setring S; S;
384  "Only the first syzygy: ";
385  RES; MRES;
386  "More syzygies: ";
387  Scontinue(10);
388  RES; MRES;
389}
390
391proc Ssyz(module M)
392"USAGE:  Ssyz(module M)
393RETURN:  ring, containing a Schreyer resolution
394PURPOSE: computes a Schreyer resolution of M of length 1 (see the library overview)
395SEE ALSO: Sres
396EXAMPLE: example Ssyz; shows an example
397"
398{
399  def S = Sinit(M); setring S;
400 
401  Sstep(); // NOTE: what if M is zero?
402
403  return (S);
404}
405example
406{ "EXAMPLE:"; echo = 2;
407  ring r;
408  module M = maxideal(1); M;
409  def S = Ssyz(M); setring S; S;
410  "Only the first syzygy: ";
411  RES;
412  MRES; // Note gen(i)
413  kill S;
414  setring r; kill M;
415
416  module M = 0;
417  def S = Ssyz(M); setring S; S;
418  "Only the first syzygy: ";
419  RES;
420  MRES;
421}
422
423proc Sres(module M, int l)
424"USAGE:  Sres(module M, int len)
425RETURN:  ring, containing a Schreyer resolution
426PURPOSE: computes a Schreyer resolution of M of length at most len (see the library overview)
427NOTE:    If given len is zero then nvars(basering) + 1 is used instead.
428SEE ALSO: Ssyz
429EXAMPLE: example Sres; shows an example
430"
431{
432  def S = Sinit(M); setring S;
433
434  if (l == 0)
435  {
436    l = nvars(basering) + 1; // not really an estimate...?!
437  }
438 
439  Sstep(); l = l - 1;
440 
441  Scontinue(l);
442 
443  return (S);
444}
445example
446{ "EXAMPLE:"; echo = 2;
447  ring r;
448  module M = maxideal(1); M;
449  def S = Sres(M, 0); setring S; S;
450  RES;
451  MRES;
452  kill S;
453  setring r; kill M;
454
455  def A = nc_algebra(-1,0); setring A;
456  ideal Q = var(1)^2, var(2)^2, var(3)^2;
457  qring SCA = twostd(Q);
458  basering;
459
460  module M = maxideal(1);
461  def S = Sres(M, 2); setring S; S;
462  RES;
463  MRES;
464}
465
466
467
468// ================================================================== //
469
470
471LIB "general.lib"; // for sort
472
473/* static proc Tail(def M) // DONE: in C++ (dyn. module: syzextra)!
474{
475  int i = ncols(M); def m;
476  while (i > 0)
477  {
478    m = M[i];
479    m = m - lead(m); // m = tail(m)   
480    M[i] = m;   
481    i--;
482  }
483  return (M);
484}*/
485
486/* static */
487proc MySort(def M)
488{
489  if( typeof( attrib(basering, "DEBUG") ) == "int" )
490  {
491    int @DEBUG = attrib(basering, "DEBUG");
492  } else
493  {
494    int @DEBUG = !system("with", "ndebug");
495  }
496
497  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
498  {
499    int @SYZCHECK = attrib(basering, "SYZCHECK");
500  } else
501  {
502    int @SYZCHECK = @DEBUG;
503  }
504
505
506  if( @DEBUG )
507  {
508    "MySort:: Input: "; M;
509  }
510
511  def @N = M; Sort_c_ds(@N);
512 
513  if( @SYZCHECK )
514  {
515    def iv = sort(lead(M), "c,ds", 1)[2]; // ,1 => reversed! // TODO: not needed?
516    def @M = M;
517    @M = M[iv];
518   
519    // 0^th syz. property
520    if( size(module( matrix(@N) - matrix(@M) )) > 0 )
521    {
522      "@M:"; @M;
523      "@N:"; @N;
524
525      "module( matrix(@N) - matrix(@M) ): ";
526      module( matrix(@N) - matrix(@M) );
527
528      "ERROR: wrong sorting in 'MySort': @N != @M!!!";
529      $
530    }
531  }
532
533  if( @DEBUG )
534  {
535    "MySort:: Ouput: "; @N;
536  }
537 
538  return (@N);
539}
540
541
542/* static */ proc SSinit(def M)
543{
544  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
545  {
546    ERROR("Sorry: need an ideal or a module for input");
547  }
548
549  // TODO! DONE?
550  def @save = basering;
551 
552  int @DEBUG = !system("with", "ndebug");
553  int @SYZCHECK = 1 || @DEBUG; // TODO: only for now!!
554 
555  if( @DEBUG )
556  {
557    "SSinit::Input";
558    type(M);
559//    DetailedPrint(M);
560    attrib(M);
561  }
562
563  int @RANK = nrows(M); int @SIZE = ncols(M);
564
565  int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
566
567  if( !@IS_A_SB )
568  {
569    def opts = option(get);
570    option(redSB); option(redTail);
571    M = std(M);
572    option(set, opts);
573    kill opts;
574  } else
575  {
576    M = simplify(M, 2 + 4 + 32);
577  }
578
579  def @N = MySort(M); // TODO: replace with inplace sorting!!!
580  def LEAD = lead(@N);
581
582  if( @SYZCHECK )
583  {
584    def @LEAD = lead(M);
585
586    // sort wrt neg.deg.rev.lex!
587    intvec iv_ds = sort(@LEAD, "c,ds", 1)[2]; // ,1 => reversed!
588
589    M = M[iv_ds]; // sort M wrt ds on current leading terms
590    @LEAD = @LEAD[iv_ds];
591
592    // 0^th syz. property
593    if( size(module( matrix(@N) - matrix(M) )) > 0 )
594    {
595      "M:"; M;
596      "@N:"; @N;
597
598      "module( matrix(@N) - matrix(M) ): ";
599      module( matrix(@N) - matrix(M) );
600
601      "ERROR: wrong sorting (in SSnit): @N != M!!!";
602      $
603    }
604
605    // 0^th syz. property
606    if( size(module( matrix(@LEAD) - matrix(LEAD) )) > 0 )
607    {
608      "LEAD:"; LEAD;
609      "@LEAD:"; @LEAD;
610
611      "module( matrix(@LEAD) - matrix(LEAD) ): ";
612      module( matrix(@LEAD) - matrix(LEAD) );
613
614      "ERROR: wrong sorting (in SSnit): @LEAD != LEAD!!!";
615      $
616    }
617   
618  }
619
620  M = @N;
621 
622 
623 
624 
625  def TAIL = Tail(M);
626 
627  intvec @DEGS = deg(M[1..@SIZE]); // store actuall degrees of input elements
628 
629  // TODO: what about real modules? weighted ones?
630 
631  list @l = ringlist(@save);
632
633  int @z = 0; ideal @m = maxideal(1); intvec @wdeg = deg(@m[1..ncols(@m)]);
634
635  // NOTE: @wdeg will be ignored anyway :(
636  @l[3] = list(list("C", @z), list("lp", @wdeg));
637
638  kill @z, @wdeg; // since these vars are ring independent!
639
640  def S = ring(@l); // --MakeInducedSchreyerOrdering(1);
641
642  module F = freemodule(@RANK);
643  intvec @V = deg(F[1..@RANK]);
644 
645  setring S; // ring with an easy divisibility test ("C, lex")
646
647  if( @DEBUG )
648  {
649    "SSinit::NewRing(C, lex)";
650    basering;
651    DetailedPrint(basering);
652  }
653
654  // Setup the leading syzygy^{-1} module to zero:
655  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
656
657  module MRES = Z;
658 
659  list RES;  RES[1] = Z;
660  list LRES; LRES[1] = Z;
661  list TRES; TRES[1] = Z;
662 
663  def M = imap(@save, M);
664
665  attrib(M, "isHomog", @V);
666  attrib(M, "isSB", 1);
667  attrib(M, "degrees", @DEGS); 
668 
669  def LEAD = imap(@save, LEAD);
670 
671  attrib(LEAD, "isHomog", @V);
672  attrib(LEAD, "isSB", 1); 
673 
674  def TAIL = imap(@save, TAIL);
675
676  if( @DEBUG )
677  {
678    "SSinit::(sorted) SB_Input: ";
679    type(M);
680    attrib(M);
681    attrib(M, "isHomog");
682//    DetailedPrint(M);
683  }
684
685  if( @SYZCHECK )
686  {
687    // 0^th syz. property
688    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
689    {
690      transpose( transpose(M) * transpose(MRES) );
691      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
692      $
693    }
694  }
695
696  RES [size(RES)+1] = M; // list of all syzygy modules
697  LRES[size(LRES)+1] = LEAD; // list of all syzygy modules
698  TRES[size(TRES)+1] = TAIL; // list of all syzygy modules
699 
700  MRES = MRES, M; //?
701
702  attrib(MRES, "isHomog", @V);
703 
704//  attrib(S, "InducionStart", @RANK);
705  attrib(S, "LEAD2SYZ", 1);
706  attrib(S, "TAILREDSYZ", 1);
707  attrib(S, "DEBUG", @DEBUG);
708  attrib(S, "SYZCHECK", @SYZCHECK);
709 
710  if( @DEBUG )
711  {
712    "SSinit::MRES";
713    MRES;
714//    DetailedPrint(MRES);
715    attrib(MRES, "isHomog");
716    attrib(S);
717  }
718
719  export RES;
720  export MRES;
721  export LRES;
722  export TRES;
723  return (S);
724}
725example
726{ "EXAMPLE:"; echo = 2;
727  ring R = 0, (w, x, y, z), dp;
728
729  def M = maxideal(1);
730  def S = SSinit(M); setring S; S;
731 
732  "Only the first initialization: ";
733  RES; LRES; TRES;
734  MRES;
735
736  kill S; setring R; kill M;
737 
738  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
739  def S = SSinit(M); setring S; S;
740
741  "Only the first initialization: ";
742  RES; LRES; TRES;
743  MRES;
744
745  kill S; setring R; kill M;
746}
747
748
749LIB "poly.lib"; // for lcm
750
751
752
753/// Compute L(Syz(L))
754proc SSComputeLeadingSyzygyTerms(def L)
755{
756  if( typeof( attrib(basering, "DEBUG") ) == "int" )
757  {
758    int @DEBUG = attrib(basering, "DEBUG");
759  } else
760  {
761    int @DEBUG = !system("with", "ndebug");
762  }
763
764  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
765  {
766    int @SYZCHECK = attrib(basering, "SYZCHECK");
767  } else
768  {
769    int @SYZCHECK = @DEBUG;
770  }
771 
772  if( @DEBUG )
773  {
774    "SSComputeLeadingSyzygyTerms::Input: ";
775    L;
776  }
777
778  module SS = ComputeLeadingSyzygyTerms(L);
779
780  if( @SYZCHECK )
781  { 
782    int i, j, r;
783    int N = ncols(L);
784    def a, b;
785    poly aa, bb;
786
787    bigint c;
788
789    ideal M;
790
791    module S = 0;
792
793    for(i = 1; i <= N; i++)
794    {
795      a = L[i];
796      c = leadcomp(a);
797      r = int(c);
798
799      aa = leadmonomial(a);
800
801      M = 0;
802
803      for(j = i-1; j > 0; j--)
804      {
805        b = L[j];
806
807        if( leadcomp(b) == c )
808        {
809          bb = leadmonomial(b);
810
811          M[j] = (lcm(aa, bb) / aa);
812        }
813      }
814
815      // TODO: add quotient relations here...
816
817      M = simplify(M, 1 + 2 + 32);
818
819      M = MySort(M);
820
821      S = S, M * gen(i);
822    }
823
824    S = MySort(simplify(S, 2));
825
826    if( size(module(matrix(S) - matrix(SS))) > 0 )
827    {
828        "ERROR: S != SS ";
829
830        "basering: ";
831        DetailedPrint(basering);
832
833        "S: ";  S;
834        DetailedPrint(S, 1);
835        "SS: "; SS;
836        DetailedPrint(SS, 1);
837
838        "DIFF: ";
839        print(matrix(S) - matrix(SS));
840        DetailedPrint(module(matrix(S) - matrix(SS)), 2);     
841        $
842    }
843  }
844
845 
846  if( @DEBUG )
847  {
848    "SSComputeLeadingSyzygyTerms::Output: ";
849    "SS: ";
850    SS;
851  }
852 
853  attrib(SS, "isSB", 1);
854
855  return (SS);
856}
857
858/// Compute Syz(L), where L is a monomial (leading) module
859proc SSCompute2LeadingSyzygyTerms(def L)
860{
861  if( typeof( attrib(basering, "DEBUG") ) == "int" )
862  {
863    int @DEBUG = attrib(basering, "DEBUG");
864  } else
865  {
866    int @DEBUG = !system("with", "ndebug");
867  }
868
869  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
870  {
871    int @SYZCHECK = attrib(basering, "SYZCHECK");
872  } else
873  {
874    int @SYZCHECK = @DEBUG;
875  }
876
877  int @TAILREDSYZ = 1;
878  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
879  {
880    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
881  }
882 
883 
884  if( @DEBUG )
885  {
886    "SSCompute2LeadingSyzygyTerms::Input: ";
887    L;
888  }
889
890  int i, j, r;
891  int N = ncols(L);
892  def a, b;
893
894  poly aa, bb, @lcm;
895
896  bigint c;
897
898  module M;
899
900  module S = 0;
901
902  for(i = 1; i <= N; i++)
903  {
904    a = L[i];
905//    "a: ", a;
906    c = leadcomp(a);
907    r = int(c);
908
909    aa = leadmonomial(a);
910
911    M = 0;
912
913    for(j = i-1; j > 0; j--)
914    {
915      b = L[j];
916//      "b: ", b;
917
918      if( leadcomp(b) == c )
919      {
920        bb = leadmonomial(b);
921        @lcm = lcm(aa, bb);
922
923        M[j] = (@lcm / aa)* gen(i) - (@lcm / bb)* gen(j);
924      }
925    }
926   
927    M = simplify(M, 2);
928
929    // TODO: add quotient relations here...
930    S = S, M;
931  }
932
933  if( @TAILREDSYZ )
934  {
935    // Make sure that 2nd syzygy terms are not reducible by 1st
936    def opts = option(get);
937    option(redSB); option(redTail);
938    S = std(S); // binomial module
939    option(set, opts);
940    //  kill opts;
941  } else
942  {
943    S = simplify(S, 2 + 32);
944  }
945
946  S = MySort(S);
947
948  if( @DEBUG )
949  {
950    "SSCompute2LeadingSyzygyTerms::Syz(LEAD): "; S;
951  }
952
953  if( @SYZCHECK )
954  {
955    if( size(S) > 0 and size(L) > 0 )
956    {
957      if( size(module(transpose( transpose(S) * transpose(L) ))) > 0 )
958      {
959        transpose( transpose(S) * transpose(L) );
960        "ERROR: transpose( transpose(S) * transpose(L) ) != 0!!!";
961        $
962      }
963    }
964   
965    module SS = Compute2LeadingSyzygyTerms(L);
966
967    "S: ";  DetailedPrint(S);
968    "SS: "; DetailedPrint(SS);
969   
970    if( size(module(matrix(S) - matrix(SS))) > 0 )
971    {
972      "ERROR: S != SS ";
973
974      "basering: ";
975      DetailedPrint(basering);
976
977      "S: ";  S;
978      DetailedPrint(S, 2);
979      "SS: "; SS;
980      DetailedPrint(SS, 2);
981
982      "DIFF: ";
983      print(matrix(S) - matrix(SS));
984      DetailedPrint(module(matrix(S) - matrix(SS)), 4);
985      $
986    }
987   
988  } 
989
990  module S2 = Tail(S);
991  S = lead(S); // (C,lp) on base ring!
992             
993  if( @DEBUG )
994  {
995    "SSCompute2LeadingSyzygyTerms::Output: "; S; S2;
996  } 
997 
998  attrib(S, "isSB", 1);
999
1000  return (S, S2);
1001}
1002
1003// -------------------------------------------------------- //
1004
1005/// TODO: save shortcut LM(m) * "t" -> ?
1006proc SSReduceTerm(poly m, def t, def L, def T, list #)
1007{
1008  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1009  {
1010    int @DEBUG = attrib(basering, "DEBUG");
1011  } else
1012  {
1013    int @DEBUG = !system("with", "ndebug");
1014  }
1015
1016  if( @DEBUG )
1017  {
1018    "SSReduce::Input: ";
1019
1020    "mult: ", m;
1021    "term: ", t;
1022    "L: ", L;
1023    "T: ", T;
1024    if( size(#) > 0 )
1025    {
1026      "LSyz: ", #;
1027    }
1028//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
1029  }
1030 
1031  vector s = 0;
1032
1033  if( t == 0 )
1034  {
1035    return (s);
1036  }
1037
1038  def product = m * t;
1039
1040  bigint c = leadcomp(t);
1041  int r = int(c);
1042 
1043  def a, b, nf, bb;
1044
1045  // looking for an appropriate reducer
1046  for( int k = ncols(L); k > 0; k-- )
1047  {
1048    a = L[k];
1049    // with the same mod. component
1050    if( leadcomp(a) == c )
1051    {
1052      b = - (leadmonomial(product) / leadmonomial(L[k]));
1053     
1054      // which divides the product
1055      if( b != 0 )
1056      {
1057//        "b: ", b;
1058        bb = b * gen(k);
1059        nf = bb;
1060
1061        if( size(#) > 0 )
1062        {
1063          if( typeof(#[1]) == "module" )
1064          {
1065            nf = NF(bb, #[1]);
1066//        "NF: ", nf;
1067          }
1068        }
1069
1070        // while the complement (the fraction) is not reducible by leading syzygies
1071        if( nf != 0 )
1072        {
1073          /// TODO: save shortcut LM(m) * T[i] -> ?
1074
1075          // choose ANY such reduction... (with the biggest index?)
1076          s = bb + SSTraverseTail(b, T[k], L, T, #);
1077          break;
1078        }
1079      }
1080    }
1081  } 
1082  if( @DEBUG )
1083  {
1084    "SSReduceTerm::Output: ", s;
1085  }
1086  return (s);
1087}
1088
1089// TODO: store m * @tail -.-^-.-^-.--> ?
1090proc SSTraverseTail(poly m, def @tail, def L, def T, list #)
1091{
1092  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1093  {
1094    int @DEBUG = attrib(basering, "DEBUG");
1095  } else
1096  {
1097    int @DEBUG = !system("with", "ndebug");
1098  }
1099
1100  if( @DEBUG )
1101  {
1102    "SSTraverse::Input: ";
1103
1104    "mult: ", m;
1105    "tail: ", @tail; // T[i];
1106
1107    if( size(#) > 0 )
1108    {
1109      "LSyz: "; #[1];
1110    }
1111  }
1112
1113  vector s = 0;
1114
1115  def @l;
1116
1117  // iterate tail-terms in ANY order!
1118  while( size(@tail) > 0 )
1119  {
1120    @l = lead(@tail);
1121    s = s + SSReduceTerm(m, @l, L, T, #);
1122    @tail = @tail - @l;
1123  }
1124
1125  if( @DEBUG )
1126  {
1127    "SSTraverseTail::Output: ", s;
1128  }
1129  return (s);
1130}
1131
1132// -------------------------------------------------------- //
1133
1134// module (N, LL, TT) = SSComputeSyzygy(L, T);
1135// Compute Syz(L ++ T) = N = LL ++ TT
1136proc SSComputeSyzygy(def L, def T)
1137{
1138  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1139  {
1140    int @DEBUG = attrib(basering, "DEBUG");
1141  } else
1142  {
1143    int @DEBUG = !system("with", "ndebug");
1144  }
1145 
1146  if( @DEBUG )
1147  {
1148    "SSComputeSyzygy::Input";
1149    "basering: ", basering; attrib(basering);
1150//    DetailedPrint(basering);
1151
1152//    "iCompShift: ", iCompShift;
1153
1154    "L: "; L;
1155    "T: "; T;
1156  }
1157
1158  def a; bigint c; int r, k; poly aa;
1159
1160  int @LEAD2SYZ = 0;
1161  if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
1162  {
1163    @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
1164  }
1165
1166  int @TAILREDSYZ = 1;
1167  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
1168  {
1169    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
1170//    @TAILREDSYZ;
1171  }
1172
1173  /// Get the critical leading syzygy terms
1174  if( @LEAD2SYZ ) // & 2nd syz. term
1175  {
1176    def a2; int r2; poly aa2; 
1177    module LL, LL2;
1178    (LL, LL2) = SSCompute2LeadingSyzygyTerms(L); // ++
1179  } else
1180  {
1181    module LL = SSComputeLeadingSyzygyTerms(L);
1182  }
1183
1184  module TT, SYZ;
1185
1186  if( size(LL) > 0 )
1187  {
1188    list LS;
1189
1190    if( @TAILREDSYZ )
1191    {
1192      LS = list(LL);
1193    }
1194   
1195    vector @tail;
1196
1197    for(k = ncols(LL); k > 0; k-- )
1198    {
1199      // leading syz. term:
1200      a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
1201      //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
1202
1203      /// TODO: save shortcut (aa) * T[r] -> ?
1204      @tail = SSTraverseTail(aa, T[r], L, T, LS);
1205             
1206      // get the 2nd syzygy term...
1207     
1208      if( @LEAD2SYZ ) // with the 2nd syz. term:
1209      {     
1210        a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
1211        @tail = @tail +
1212             /// TODO: save shortcut (aa2) * T[r2] -> ?
1213             a2 + SSTraverseTail(aa2, T[r2], L, T, LS);
1214      } else
1215      {
1216        @tail = @tail + SSReduceTerm(aa, L[r], L, T, LS);
1217      }     
1218     
1219      TT[k] = @tail;
1220      SYZ[k] = a + @tail;
1221    }
1222  }
1223
1224/*
1225  def opts = option(get); option(redSB); option(redTail);
1226  module SYZ = std(syz(M));
1227  option(set, opts); kill opts;
1228 
1229  module LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
1230  module TT = Tail(SYZ);
1231*/
1232 
1233  if( @DEBUG )
1234  {
1235    "SSComputeSyzygy::Output";
1236
1237    "SYZ: "; SYZ;
1238    "LL: "; LL;
1239    "TT: "; TT;
1240  }
1241
1242  return (SYZ, LL, TT);
1243}
1244
1245// resolution/syzygy step:
1246static proc SSstep()
1247{
1248  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1249  {
1250    int @DEBUG = attrib(basering, "DEBUG");
1251  } else
1252  {
1253    int @DEBUG = !system("with", "ndebug");
1254  }
1255
1256
1257  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
1258  {
1259    int @SYZCHECK = attrib(basering, "SYZCHECK");
1260  } else
1261  {
1262    int @SYZCHECK = @DEBUG;
1263  }
1264
1265  if( @DEBUG )
1266  {
1267    "SSstep::NextInducedRing";
1268    "basering: ", basering; attrib(basering);
1269  }
1270
1271/*
1272  // is initial weights are all zeroes!
1273  def L =  lead(M);
1274  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
1275  SetInducedReferrence(L, @RANK, 0);
1276*/
1277
1278//  def L =  lead(MRES);
1279//  @W = @W, @V;
1280//  attrib(L, "isHomog", @W); 
1281
1282
1283  // General setting:
1284//  SetInducedReferrence(MRES, 0, 0); // limit: 0!
1285  int @l = size(RES);
1286
1287  def M =  RES[@l];
1288
1289  def L = LRES[@l];
1290  def T = TRES[@l];
1291
1292
1293  //// TODO: wrong !!!!!
1294  int @RANK = ncols(MRES) - ncols(M); // nrows(M); // what if M is zero?!
1295
1296 
1297
1298/*
1299  if( @RANK !=  nrows(M) )
1300  {
1301    type(MRES);
1302    @RANK;
1303    type(M);
1304    pause();
1305  }
1306*/
1307 
1308  intvec @W = attrib(M, "isHomog"); intvec @V = attrib(M, "degrees"); @V = @W, @V;
1309   
1310  if( @DEBUG )
1311  {
1312    "Sstep::NextInput: ";
1313    M;
1314    L;
1315    @V;
1316    @RANK;
1317//    DetailedPrint(MRES);
1318    attrib(MRES, "isHomog");
1319  }
1320
1321     
1322  // TODO: N  = SYZ( M )!!!
1323  module N, LL, TT;
1324  (N, LL, TT) = SSComputeSyzygy(/*M, */L, T/*, @RANK*/);
1325
1326  // shift syz.comp by @RANK:
1327  module Z;
1328  Z = 0; Z[@RANK] = 0; Z = Z, transpose(LL);   LL = transpose(Z);
1329  Z = 0; Z[@RANK] = 0; Z = Z, transpose(TT);   TT = transpose(Z);
1330  Z = 0; Z[@RANK] = 0; Z = Z, transpose(N);     N = transpose(Z);
1331
1332
1333  if( @SYZCHECK )
1334  {
1335    if( size(N) > 0 )
1336    {
1337      // next syz. property
1338      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
1339      {
1340        "MRES", MRES;
1341
1342        "N: "; N; // DetailedPrint(N, 2);
1343
1344        "LL:"; LL; // DetailedPrint(LL, 1);
1345        "TT:"; TT; // DetailedPrint(TT, 10);
1346
1347        "RANKS: ", @RANK;
1348
1349        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
1350        transpose( transpose(N) * transpose(MRES) );
1351
1352        "transpose(N) * transpose(MRES): ";
1353        transpose(N) * transpose(MRES);
1354        // DetailedPrint(module(_), 2);
1355        $
1356      }
1357    }
1358  }
1359
1360  attrib(N, "isHomog", @V);
1361
1362  // TODO: correct the following:
1363  intvec @DEGS = deg(N[1..ncols(N)]); // no mod. comp. weights :(
1364
1365 
1366  attrib(N, "degrees", @DEGS);
1367 
1368   RES[@l + 1] = N; // list of all syzygy modules
1369  LRES[@l + 1] = LL; // list of all syzygy modules
1370  TRES[@l + 1] = TT; // list of all syzygy modules
1371
1372  MRES = MRES, N;
1373 
1374  attrib(MRES, "isHomog", @V);
1375
1376//  L = L, lead(N);  attrib(basering, "InducionLeads", L);
1377
1378  if( @DEBUG )
1379  {
1380    "SSstep::NextSyzOutput: ";
1381    N;
1382//    DetailedPrint(N);
1383    attrib(N);
1384  }
1385
1386}
1387
1388proc SScontinue(int l)
1389"USAGE:  SScontinue(l)
1390RETURN:  nothing, instead it changes RES and MRES variables in the current ring
1391PURPOSE: computes further (at most l) syzygies
1392NOTE:    must be used within a ring returned by Sres or Ssyz. RES and MRES are
1393         explained in Sres
1394EXAMPLE: example Scontinue; shows an example
1395"
1396{
1397
1398  /// TODO!
1399//  def data = GetInducedData();
1400
1401  if( (!defined(RES)) || (!defined(MRES)) ) /* || (typeof(data) != "list") || (size(data) != 2) */
1402  {
1403    ERROR("Sorry, but basering does not seem to be returned by Sres or Ssyz");
1404  }
1405  for (;  (l != 0) && (size(RES[size(RES)]) > 0); l-- )
1406  {
1407    SSstep();
1408  }
1409}
1410example
1411{ "EXAMPLE:"; echo = 2;
1412  ring r;
1413  module M = maxideal(1); M;
1414  def S = SSsyz(M); setring S; S;
1415  "Only the first syzygy: ";
1416  RES; MRES;
1417  "More syzygies: ";
1418  SScontinue(10);
1419  RES; MRES;
1420}
1421
1422proc SSsyz(def M)
1423"USAGE:  SSsyz(M)
1424RETURN:  ring, containing a list of modules RES and a module MRES
1425PURPOSE: computes the first syzygy module of M (wrt some Schreyer ordering)?
1426NOTE:    The output is explained in Sres
1427EXAMPLE: example Ssyz; shows an example
1428"
1429{
1430  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1431  {
1432    ERROR("Sorry: need an ideal or a module for input");
1433  }
1434
1435  def SS = SSinit(M); setring SS;
1436 
1437  SSstep(); // NOTE: what if M is zero?
1438
1439  return (SS);
1440}
1441example
1442{ "EXAMPLE:"; echo = 2;
1443  ring r;
1444
1445/*  ideal M = 0;
1446  def S = SSsyz(M); setring S; S;
1447  "Only the first syzygy: ";
1448  RES; LRES; TRES;
1449  MRES;
1450 
1451  kill S; setring r; kill M;
1452*/ 
1453
1454  ideal M = maxideal(1); M;
1455  def S = SSres(M, 0); setring S; S;
1456  MRES;
1457  RES;
1458  "";
1459  LRES;
1460  "";
1461  TRES;
1462
1463  kill S; setring r; kill M;
1464
1465  kill r;
1466 
1467  ring R = 0, (w, x, y, z), dp;
1468  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
1469 
1470  def S = SSres(M, 0); setring S; S;
1471  MRES;
1472  RES;
1473  "";
1474  LRES;
1475  "";
1476  TRES;
1477}
1478
1479proc SSres(def M, int l)
1480"USAGE:  SSres(I, l)
1481RETURN:  ring, containing a list of modules RES and a module MRES
1482PURPOSE: computes (at most l) syzygy modules of M wrt the classical Schreyer
1483         induced ordering with gen(i) > gen(j) if i > j, provided both gens
1484         are from the same syzygy level.???
1485NOTE:    RES contains the images of maps subsituting the beginning of the
1486         Schreyer free resolution of baseRing^r/M, while MRES is a sum of
1487         these images in a big free sum, containing all the syzygy modules.
1488         The syzygy modules are shifted so that gen(i) correspons to MRES[i].
1489         The leading zero module RES[0] indicates the fact that coker of the
1490         first map is zero. The number of zeroes inducates the rank of input.
1491NOTE:    If l == 0 then l is set to be nvars(basering) + 1
1492EXAMPLE: example SSres; shows an example
1493"
1494{
1495  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1496  {
1497    ERROR("Sorry: need an ideal or a module for input");
1498  }
1499
1500  def SS = SSinit(M); setring SS;
1501
1502  if (l == 0)
1503  {
1504    l = nvars(basering) + 1; // not really an estimate...?!
1505  }
1506
1507  SSstep(); l = l - 1;
1508
1509  SScontinue(l);
1510
1511  return (SS);
1512}
1513example
1514{ "EXAMPLE:"; echo = 2;
1515  ring r;
1516  module M = maxideal(1); M;
1517  def S = SSres(M, 0); setring S; S;
1518  RES;
1519  MRES;
1520  kill S;
1521  setring r; kill M;
1522
1523  def A = nc_algebra(-1,0); setring A;
1524  ideal Q = var(1)^2, var(2)^2, var(3)^2;
1525  qring SCA = twostd(Q);
1526  basering;
1527
1528  module M = maxideal(1);
1529  def S = SSres(M, 2); setring S; S;
1530  RES;
1531  MRES;
1532}
1533
1534
1535
1536static proc loadme()
1537{
1538  int @DEBUG = !system("with", "ndebug");
1539
1540  if( @DEBUG )
1541  {
1542   
1543    "ndebug?: ", system("with", "ndebug");
1544    "om_ndebug?: ", system("with", "om_ndebug");
1545
1546    listvar(Top);
1547    listvar(Schreyer);
1548  }
1549//  listvar(Syzextra); listvar(Syzextra_g);
1550
1551  if( !defined(DetailedPrint) )
1552  {
1553    if( 1 )
1554    {
1555
1556      if( @DEBUG )
1557      {
1558        "Loading the Release version!";
1559      }
1560      load("syzextra.so");
1561
1562      if( @DEBUG )
1563      {
1564        listvar(Syzextra);
1565      }
1566
1567      exportto(Top, Syzextra::ClearContent);
1568      exportto(Top, Syzextra::ClearDenominators);
1569
1570      exportto(Schreyer, Syzextra::m2_end);
1571     
1572//      export Syzextra;
1573
1574//      exportto(Schreyer, Syzextra::noop);
1575      exportto(Schreyer, Syzextra::DetailedPrint);
1576      exportto(Schreyer, Syzextra::leadmonomial);
1577      exportto(Schreyer, Syzextra::leadcomp);
1578//      exportto(Schreyer, Syzextra::leadrawexp);
1579//      exportto(Schreyer, Syzextra::ISUpdateComponents);
1580      exportto(Schreyer, Syzextra::SetInducedReferrence);
1581      exportto(Schreyer, Syzextra::GetInducedData);
1582//      exportto(Schreyer, Syzextra::GetAMData);
1583//      exportto(Schreyer, Syzextra::SetSyzComp);
1584      exportto(Schreyer, Syzextra::MakeInducedSchreyerOrdering);
1585//      exportto(Schreyer, Syzextra::MakeSyzCompOrdering);
1586      exportto(Schreyer, Syzextra::idPrepare);
1587//      exportto(Schreyer, Syzextra::reduce_syz);
1588//      exportto(Schreyer, Syzextra::p_Content);
1589
1590      exportto(Schreyer, Syzextra::ProfilerStart); exportto(Schreyer, Syzextra::ProfilerStop);
1591
1592      exportto(Schreyer, Syzextra::Tail);
1593      exportto(Schreyer, Syzextra::ComputeLeadingSyzygyTerms);     
1594      exportto(Schreyer, Syzextra::Compute2LeadingSyzygyTerms);
1595      exportto(Schreyer, Syzextra::Sort_c_ds);
1596    }
1597/*
1598    else
1599    {
1600      if( @DEBUG )
1601      {
1602        "Loading the Debug version!";
1603      }
1604
1605      load("syzextra.so");
1606
1607      if( @DEBUG )
1608      {     
1609        listvar(Syzextra_g);
1610      }
1611     
1612      exportto(Top, Syzextra_g::ClearContent);
1613      exportto(Top, Syzextra_g::ClearDenominators);
1614
1615      exportto(Schreyer, Syzextra_g::m2_end);
1616
1617//      export Syzextra_g;
1618//      exportto(Schreyer, Syzextra_g::noop);
1619      exportto(Schreyer, Syzextra_g::DetailedPrint);
1620      exportto(Schreyer, Syzextra_g::leadmonomial);
1621      exportto(Schreyer, Syzextra_g::leadcomp);
1622//      exportto(Schreyer, Syzextra_g::leadrawexp);
1623//      exportto(Schreyer, Syzextra_g::ISUpdateComponents);
1624      exportto(Schreyer, Syzextra_g::SetInducedReferrence);
1625      exportto(Schreyer, Syzextra_g::GetInducedData);
1626//      exportto(Schreyer, Syzextra_g::GetAMData);
1627//      exportto(Schreyer, Syzextra_g::SetSyzComp);
1628      exportto(Schreyer, Syzextra_g::MakeInducedSchreyerOrdering);
1629//      exportto(Schreyer, Syzextra_g::MakeSyzCompOrdering);
1630      exportto(Schreyer, Syzextra_g::idPrepare);
1631//      exportto(Schreyer, Syzextra_g::reduce_syz);
1632//      exportto(Schreyer, Syzextra_g::p_Content);
1633
1634      exportto(Schreyer, Syzextra_g::ProfilerStart); exportto(Schreyer, Syzextra_g::ProfilerStop);
1635
1636      exportto(Schreyer, Syzextra_g::Tail);
1637      exportto(Schreyer, Syzextra_g::ComputeLeadingSyzygyTerms);
1638      exportto(Schreyer, Syzextra_g::Compute2LeadingSyzygyTerms);
1639      exportto(Schreyer, Syzextra_g::Sort_c_ds);
1640     
1641    }
1642*/
1643
1644    exportto(Top, DetailedPrint);
1645    exportto(Top, GetInducedData);
1646
1647    if( @DEBUG )
1648    {
1649      listvar(Top);
1650      listvar(Schreyer);
1651    }
1652  }
1653 
1654  if( !defined(GetInducedData) )
1655  {
1656    ERROR("Sorry but we are missing the dynamic module (syzextra.so)...");
1657  }
1658
1659}
1660
1661static proc mod_init()
1662{
1663  loadme();
1664}
1665
1666
1667proc testallSexamples()
1668{
1669  example Ssyz;
1670  example Scontinue;
1671  example Sres; 
1672}
1673
1674proc testallSSexamples()
1675{
1676  example SSsyz;
1677  example SScontinue;
1678  example SSres; 
1679}
1680
1681example
1682{ "EXAMPLE:"; echo = 2;
1683  testallSexamples();
1684  testallSSexamples();
1685}
Note: See TracBrowser for help on using the repository browser.