Changeset e44b149 in git for Singular


Ignore:
Timestamp:
Jul 3, 2013, 12:04:32 PM (11 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
f80a5305e1e0960855d4bd8702e48d1c2bbf8710
Parents:
a667138296109b29e11fe1654025d4581abfc50a
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2013-07-03 12:04:32+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2013-07-18 14:56:50+02:00
Message:
fix: missed assume for allowing empty bigintmats
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gitfan.lib

    ra667138 re44b149  
    2727
    2828LIB "parallel.lib"; // for parallelWaitAll
     29LIB "general.lib";
    2930
    3031////////////////////////////////////////////////////
    31 proc mod_init()
    32 {
    33   LIB"gfanlib.so";
    34 }
    35 
    36 static proc int2face(int n, int r)
     32
     33proc int2face(int n, int r)
    3734{
    3835  int k = r-1;
     
    4340    while(2^k > n0){
    4441      k--;
    45       //v[size(v)+1] = 0;
    4642    }
    4743
     
    5652/////////////////////////////////
    5753
    58 proc isAface(ideal a, intvec gam0)
     54proc isAface(ideal a, intvec gam0, int n)
    5955"USAGE:  isAface(a,gam0); a: ideal, gam0:intvec
    6056PURPOSE: Checks whether the face of the positive orthant,
     
    6662"
    6763{
    68   poly pz;
    69 
    7064  // special case: gam0 is the zero-cone:
    7165  if (size(gam0) == 1 and gam0[1] == 0){
    72     ideal G;
     66    poly pz; ideal G;
    7367
    7468    // is an a-face if and only if RL0(0,...,0) = const
     
    9387  }
    9488
    95 
    96   // ring is too big: Switch to KK[T_i; e_i\in gam0] instead:
     89  // ring is too big: Switch to KK[T_i | e_i\in gam0] instead:
     90  intvec w=ringlist(basering)[3][1][2];
     91  intvec w0;
    9792  string initNewRing = "ring Rgam0 = 0,(";
    9893
    9994  for (int i=1; i<size(gam0); i++){
    10095    initNewRing = initNewRing + string(var(gam0[i])) + ",";
    101   }
    102 
     96    w0[i]=w[gam0[i]];
     97  }
     98
     99  w0 = w0,w[gam0[i]],1;
     100  initNewRing = initNewRing + string(var(gam0[size(gam0)])) + ",U),Wp("+string(w0)+");";
     101  def R = basering;
     102  execute(initNewRing);
     103
     104  ideal agam0 = imap(R,a);
     105
     106  for (i = 1; i<=size(agam0); i=i+1)
     107  {
     108    if (size(agam0[i]) == 1)
     109    { return(0,0); }
     110  }
     111
     112  poly p = var(1); // first entry of g; p = prod T_i with i element of g
     113  for ( i = 2; i <= nvars(basering); i++ ) {
     114      p = p * var(i);
     115    }
     116  // p is now the product over all T_i, with e_i in gam0
     117
     118  agam0 = agam0, p - 1; // rad-membership
     119  agam0 = timeStd(agam0,5);
     120  // "timestd finished after: "+string(timer-t);
     121  // int timeout = 0;
     122  if (attrib(agam0,"isSB") < 1)
     123  {
     124    kill agam0; kill Rgam0; kill initNewRing; kill w; kill w0; setring R; kill R;
     125    return(0,1);
     126    // // "timestd failed in "+string(gam0)+", falling back to saturation!";
     127    // setring R; kill Rgam0;
     128
     129    // initNewRing = "ring Rgam0 = 0,(";
     130
     131    // w0 = 0;
     132    // for (i=1; i<size(gam0); i++){
     133    //   initNewRing = initNewRing + string(var(gam0[i])) + ",";
     134    //   w0[i]=w[gam0[i]];
     135    // }
     136
     137    // w0 = w0,w[gam0[i]];
     138    // initNewRing = initNewRing + string(var(gam0[size(gam0)])) + "),Wp("+string(w0)+");";
     139    // execute(initNewRing);
     140
     141    // ideal G = imap(R,a);
     142
     143    // timeout = 1;
     144    // int t=rtimer;
     145    // for(int k=nvars(basering); k>0; k--) { G=sat(G,var(k))[1]; }
     146    // t = (rtimer - t) div 1000;
     147    // string(n)+": saturation successful after "+string(t)+" with: "+string(G<>1);
     148  }
     149
     150  // does G contain 1?, i.e. is G = 1?
     151  if(agam0 <> 1) {
     152    kill agam0; kill Rgam0; kill initNewRing; kill w; kill w0; setring R; kill R;
     153    return(1,0); // true
     154  }
     155
     156  kill agam0; kill Rgam0; kill initNewRing; kill w; kill w0; setring R; kill R;
     157  return(0,0); // false
     158}
     159example
     160{
     161  echo = 2;
     162
     163  ring R = 0,(T(1..4)),dp;
     164  ideal I = T(1)*T(2)-T(4);
     165
     166  intvec w = 1,4;
     167  intvec v = 1,2,4;
     168
     169  isAface(I,w); // should be 0
     170  "-----------";
     171  isAface(I,v); // should be 1
     172}
     173
     174
     175proc isAfaceNonZero(ideal a, intvec gam0)
     176{
     177  string initNewRing = "ring Rgam0 = 0,(";
     178  for (int i=1; i<size(gam0); i++)
     179    { initNewRing = initNewRing + string(var(gam0[i])) + ","; }
    103180  initNewRing = initNewRing + string(var(gam0[size(gam0)])) + "),dp;";
    104181  def R = basering;
     
    107184  ideal agam0 = imap(R,a);
    108185
    109   poly p = var(1); // first entry of g; p = prod T_i with i element of g
    110   for ( i = 2; i <= nvars(basering); i++ ) {
    111       p = p * var(i);
    112     }
    113   // p is now the product over all T_i, with e_i in gam0
    114 
    115   agam0 = agam0, p - 1; // rad-membership
     186  for ( i = 1; i<=size(agam0); i=i+1)
     187    { if (size(agam0[i]) == 1) { return(0); } }
     188
     189  poly p = var(1);
     190  for ( i = 2; i <= nvars(basering); i++ )
     191    { p = p * var(i); }
     192
     193  agam0 = agam0, p - 1;
    116194  ideal G = std(agam0);
    117195
    118   // does G contain 1?, i.e. is G = 1?
    119   if(G <> 1) {
    120     return(1); // true
    121   }
    122 
    123   return(0); // false
    124 }
    125 example
    126 {
    127   echo = 2;
    128 
    129   ring R = 0,(T(1..4)),dp;
    130   ideal I = T(1)*T(2)-T(4);
    131 
    132   intvec w = 1,4;
    133   intvec v = 1,2,4;
    134 
    135   isAface(I,w); // should be 0
    136   "-----------";
    137   isAface(I,v); // should be 1
    138 }
    139 
     196  if(G <> 1)
     197    { return(1); }
     198
     199  return(0);
     200}
    140201////////////////////////////////////////////////////
    141202
     
    145206  list AF;
    146207
    147   for(i = start; i <= end; i++){
     208  for(i = start; i <= end; i=i+1){
    148209    if(i < 2^r){
     210      string(i)+"    "+string(size(AF));
    149211      gam0 = int2face(i,r);
    150212
     
    165227
    166228proc afaces(ideal a, list #)
    167 "USAGE:  afaces(a, b, c); a: ideal, d: int, c: int
     229"USAGE:  afaces(a, b, c); a: ideal, b: int, c: int
    168230PURPOSE: Returns a list of all a-faces (represented by intvecs).
    169231         Moreover, it is possible to specify a dimensional bound b,
     
    210272
    211273  // do remaining ones:
    212   for(i = ncores * step +1; i < 2^r; i++){
     274  for(i = ncores * step +1; i < 2^r; i=i+1){
    213275    "another one needed";
    214276    gam0 = int2face(i,r);
     
    223285  }
    224286
     287  int l;
    225288  // read out afaces of out into AF:
    226   for(i = 1; i <= size(out); i++){
    227     AF = AF + out[i];
     289  for(l = 1; l <= size(out); l++){
     290    AF = AF + out[l];
    228291  }
    229292
Note: See TracChangeset for help on using the changeset viewer.