Changeset ae6124 in git


Ignore:
Timestamp:
Oct 31, 2008, 4:33:07 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
Children:
78b28b48625d983087e8a0d1c0db9632f68e0320
Parents:
e1792782ae1256a5df2ecf6ead8321a3eae8a3e4
Message:
*hannes: nselect, etc


git-svn-id: file:///usr/local/Singular/svn/trunk@11171 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/elim.lib

    re17927 rae6124  
    1 // $Id: elim.lib,v 1.23 2008-10-06 17:04:26 Singular Exp $
    2 // (GMG, last modified 22.06.96)
    3 ///////////////////////////////////////////////////////////////////////////////
    4 version="$Id: elim.lib,v 1.23 2008-10-06 17:04:26 Singular Exp $";
     1// $Id: elim.lib,v 1.24 2008-10-31 15:33:07 Singular Exp $
     2///////////////////////////////////////////////////////////////////////////////
     3version="$Id: elim.lib,v 1.24 2008-10-31 15:33:07 Singular Exp $";
    54category="Commutative Algebra";
    65info="
     
    87
    98PROCEDURES:
    10  blowup0(j[,s1,s2]);    create presentation of blownup ring of ideal j
    11  elim(id,v);            eliminate variables in v from id (ideal/module)
    12  elim1(id,p);           p=product of vars to be eliminated from id
    13  nselect(id,v);         select generators not containing variables given by v
    14  sat(id,j);             saturated quotient of ideal/module id by ideal j
    15  select(id,v);          select generators containing all variables given by v
    16  select1(id,v);         select generators containing one variable given by v
    17 
     9 blowup0(j[,s1,s2]);   create presentation of blownup ring of ideal j
     10 elim(id,..);          variables .. eliminated from id (ideal/module)
     11 elim1(id,p);          p=product of vars to be eliminated from id
     12 nselect(id,v);        select generators not containing variables given by v
     13 sat(id,j);            saturated quotient of ideal/module id by ideal j
     14 select(id,v]);        select generators containing all variables given by v
     15 select1(id,v);        select generators containing one variable given by v
    1816           (parameters in square brackets [] are optional)
    1917";
     
    227225}
    228226///////////////////////////////////////////////////////////////////////////////
    229 
    230227proc elim1 (id, poly vars)
    231228"USAGE:   elim1(id,p); id ideal/module, p product of vars to be eliminated
    232229RETURN:  ideal/module obtained from id by eliminating vars occuring in poly
    233 NOTE:    no special monomial ordering is required, result is a SB with
    234          respect to ordering dp (resp. ls) if the first var not to be
    235          eliminated belongs to a -p (resp. -s) blockordering
     230METHOD:  elim1 calls eliminate but in a ring with ordering dp (resp. ls)
     231         if the first var not to be eliminated belongs to a -p (resp. -s)
     232         ordering.
     233NOTE:    no special monomial ordering is required.
    236234         This proc uses 'execute' or calls a procedure using 'execute'.
    237235SEE ALSO: elim, eliminate
     
    239237"
    240238{
     239   def br = basering;
     240   if ( size(ideal(br)) != 0 )
     241   {
     242      ERROR ("cannot eliminate in a qring");
     243   }
    241244//---- get variables to be eliminated and create string for new ordering ------
    242245   int ii;
     
    248251   if( ord(p)>0 ) { string ordering = "),dp;"; }
    249252//-------------- create new ring and map objects to new ring ------------------
    250    def br = basering;
    251253   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
    252254   execute(str);
     
    267269}
    268270///////////////////////////////////////////////////////////////////////////////
    269 
    270 proc nselect (id_inp, intvec v)
    271 "USAGE:   nselect(id,v); id = module or ideal, v = intvec
    272 RETURN:  generators of id not containing the variables with index an entry of v
     271proc nselect (id, intvec v)
     272"USAGE:   nselect(id,v); id = ideal, module or matrix, v = intvec
     273RETURN:  generators (or columns) of id not containing the variables with index
     274        an entry of v
    273275SEE ALSO: select, select1
    274276EXAMPLE: example nselect; shows examples
    275 "
    276 {
    277   if (typeof(id_inp)!="ideal") { module id=module(id_inp); }
    278   else                         { ideal id=id_inp;         }
    279   int j,k;
    280   int n,m = size(v), ncols(id);
    281   //listvar(id);
    282   for( k=1; k<=m; k++ )
    283   { 
    284     for( j=1; j<=n; j++ )
    285     { 
    286       if( size(id[k]/var(v[j]))!=0 )
    287       {
    288          id[k]=0; break;
    289       }
    290     }
    291   }
    292   //if(typeof(id)=="ideal") { return(simplify(id,2)); }
    293   //return(simplify(module(id),2));
    294   id=(simplify(module(id),2));
    295   //listvar(id);
    296   return(id);
    297   //return(simplify(id,2));
     277"{
     278   if (typeof(id)!="ideal")
     279   {
     280     if (typeof(id)=="module" || typeof(id)=="matrix")
     281     {
     282       module id1 = module(id);
     283     }
     284     else
     285     {
     286       ERROR("// *** input must be of type ideal or module or matrix");
     287     }
     288   }
     289   else
     290   {
     291      ideal id1 = id;
     292   }
     293   int j,k;
     294   int n,m = size(v), ncols(id1);
     295   for( k=1; k<=m; k++ )
     296   {
     297      for( j=1; j<=n; j++ )
     298      {
     299        if( size(id1[k]/var(v[j]))!=0 )
     300        {
     301           id1[k]=0; break;
     302        }
     303      }
     304   }
     305   id1=simplify(id1,2);
     306   if(typeof(id)=="matrix")
     307   {
     308      return(matrix(id1));
     309   }
     310   return(id1);
    298311}
    299312example
     
    303316   nselect(i,3);
    304317   module m=i*(gen(1)+gen(2));
    305    show(m);
    306    show(nselect(m,3..4));
     318   m;
     319   nselect(m,3..4);
     320   nselect(matrix(m),3..4);
    307321}
    308322///////////////////////////////////////////////////////////////////////////////
     
    347361}
    348362///////////////////////////////////////////////////////////////////////////////
    349 
    350363proc select (id, intvec v)
    351 "USAGE:   select(id,n[,m]); id = ideal/module, v= intvec
    352 RETURN:  generators of id containing all variables with index an entry of v
    353 NOTE:    use 'select1' for selecting generators containing at least one of the
    354          variables with index an entry of v
     364"USAGE:   select(id,n[,m]); id = ideal/module/matrix, v = intvec
     365RETURN:  generators/columns of id containing all variables with index
     366         an entry of v
     367NOTE:    use 'select1' for selecting generators/columns containing at least
     368         one of the variables with index an entry of v
    355369SEE ALSO: select1, nselect
    356370EXAMPLE: example select; shows examples
    357371"{
     372   if (typeof(id)!="ideal")
     373   {
     374     if (typeof(id)=="module" || typeof(id)=="matrix")
     375     {
     376       module id1 = module(id);
     377     }
     378     else
     379     {
     380       ERROR("// *** input must be of type ideal or module or matrix");
     381     }
     382   }
     383   else
     384   {
     385     ideal id1 = id;
     386   }
    358387   int j,k;
    359    int n,m = size(v), ncols(id);
     388   int n,m = size(v), ncols(id1);
    360389   for( k=1; k<=m; k++ )
    361    { 
     390   {
    362391      for( j=1; j<=n; j++ )
    363       {   
    364          if( size(id[k]/var(v[j]))==0)
    365          { 
    366             id[k]=0; break;
     392      {
     393         if( size(id1[k]/var(v[j]))==0)
     394         {
     395            id1[k]=0; break;
    367396         }
    368397      }
    369398   }
    370    return(simplify(id,2));
     399   if(typeof(id)=="matrix")
     400   {
     401      return(matrix(simplify(id1,2)));
     402   }
     403   return(simplify(id1,2));
    371404}
    372405example
     
    379412   m;
    380413   select(m,1..2);
     414   select(matrix(m),1..2);
    381415}
    382416///////////////////////////////////////////////////////////////////////////////
    383417
    384418proc select1 (id, intvec v)
    385 "USAGE:   select1(id,v); id = ideal/module, v = intvec
    386 RETURN:  generators of id containing at least one of the variables with
    387          index an entry of v
    388 NOTE:    use 'select' for selecting generators containing all the
    389          variables with index an entry of v
     419"USAGE:   select1(id,v); id = ideal/module/matrix, v = intvec
     420RETURN:  generators/columns of id containing at least one of the variables
     421         with index an entry of v
     422NOTE:    use 'select' for selecting generators/columns containing all variables
     423         with index an entry of v
    390424SEE ALSO: select, nselect
    391425EXAMPLE: example select1; shows examples
    392426"{
     427   if (typeof(id)!="ideal")
     428   {
     429     if (typeof(id)=="module" || typeof(id)=="matrix")
     430     {
     431       module id1 = module(id);
     432       module I;
     433     }
     434     else
     435     {
     436       ERROR("// *** input must be of type ideal or module or matrix");
     437     }
     438   }
     439   else
     440   {
     441     ideal id1 = id;
     442     ideal I;
     443   }
    393444   int j,k;
    394    int n,m = size(v), ncols(id);
    395    execute (typeof(id)+" I;");
     445   int n,m = size(v), ncols(id1);
    396446   for( k=1; k<=m; k++ )
    397447   {  for( j=1; j<=n; j++ )
    398448      {
    399          if( size(subst(id[k],var(v[j]),0)) != size(id[k]) )
    400          { 
    401             I = I,id[k]; break;
     449         if( size(subst(id1[k],var(v[j]),0)) != size(id1[k]) )
     450         {
     451            I = I,id1[k]; break;
    402452         }
    403453      }
    404454   }
    405    return(simplify(I,2));
     455   I=simplify(I,2);
     456   if(typeof(id)=="matrix")
     457   {
     458      return(matrix(I));
     459   }
     460   return(I);
    406461}
    407462example
     
    409464   ring r=0,(x,y,t,s,z),(c,dp);
    410465   ideal i=x-y,y-z2,z-t3,s-x+y3;
    411    ideal j=select1(i,1);
    412    j;
    413    module m=i*(gen(1)+gen(2));
    414    m;
     466   ideal j=select1(i,1);j;
     467   module m=i*(gen(1)+gen(2)); m;
    415468   select1(m,1..2);
    416 }
    417 ///////////////////////////////////////////////////////////////////////////////
     469   select1(matrix(m),1..2);
     470}
     471///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.