Changeset 4cb6b8 in git


Ignore:
Timestamp:
Jan 7, 2001, 2:56:52 AM (23 years ago)
Author:
Gert-Martin Greuel <greuel@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f74e95cfbb3d354be6beae9aa43c8da9c42ca6a6
Parents:
b5726ce4d97d33dace26cc34caed15f16bb4cb26
Message:
* GMG: Kosmetik; proc ringweights von general.lib eingefuegt


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/ring.lib

    rb5726c r4cb6b8  
    11//(GMG, last modified 03.11.95)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: ring.lib,v 1.15 2000-12-31 01:57:42 greuel Exp $";
     3version="$Id: ring.lib,v 1.16 2001-01-07 01:56:52 greuel Exp $";
    44category="General purpose";
    55info="
     
    1919 ord_test(R);             test wether ordering of R is global, local or mixed
    2020 ringtensor(\"R\",s,t,..);create ring R, tensor product of rings s,t,...
    21            (parameters in square brackets [] are optional)
     21 ringweights(r);          intvec of weights of ring variables of ring r
     22             (parameters in square brackets [] are optional)
    2223";
    2324
     
    754755}
    755756///////////////////////////////////////////////////////////////////////////////
     757
     758proc ringweights (list # )
     759"USAGE:   ringweights(P); P=name of an existing ring (true name, not a string)
     760RETURN:  intvec consisting of the weights of the variables of P, as they
     761         appear when typing P;.
     762NOTE:    This is useful when enlarging P but keeping the weights of the old
     763         variables.
     764EXAMPLE: example ringweights; shows an example
     765"
     766{
     767   int ii,q,fi,fo,fia;
     768   intvec rw,nw;
     769   string os;
     770   def P = #[1];
     771   string osP = ordstr(P);
     772   fo  = 1;
     773//------------------------- find weights in ordstr(P) -------------------------
     774   fi  = find(osP,"(",fo);
     775   fia = find(osP,"a",fo)+find(osP,"w",fo)+find(osP,"W",fo);
     776   while ( fia )
     777   {
     778      os = osP[fi+1,find(osP,")",fi)-fi-1];
     779      if( find(os,",") )
     780      {
     781         execute("nw = "+os+";");
     782         if( size(nw) > ii )
     783         {
     784             rw = rw,nw[ii+1..size(nw)];
     785         }
     786         else  {  ii = ii - size(nw); }
     787
     788         if( find(osP[1,fi],"a",fo) ) { ii = size(nw); }
     789      }
     790      else
     791      {
     792         execute("q = "+os+";");
     793         if( q > ii )
     794         {
     795            nw = 0; nw[q-ii] = 0;
     796            nw = nw + 1;          //creates an intvec 1,...,1 of length q-ii
     797            rw = rw,nw;
     798         }
     799         else { ii = ii - q; }
     800      }
     801      fo  = fi+1;
     802      fi  = find(osP,"(",fo);
     803      fia = find(osP,"a",fo)+find(osP,"w",fo)+find(osP,"W",fo);
     804   }
     805//-------------- adjust weight vector to length = nvars(P)  -------------------
     806   if( fo > 1 )
     807   {                                            // case when weights were found
     808      rw = rw[2..size(rw)];
     809      if( size(rw) > nvars(P) )
     810      {
     811         rw = rw[1..nvars(P)];
     812      }
     813      if( size(rw) < nvars(P) )
     814      {
     815         nw=0; nw[nvars(P)-size(rw)]=0; nw=nw+1; rw=rw,nw;
     816      }
     817   }
     818   else
     819   {                                         // case when no weights were found
     820      rw[nvars(P)]= 0; rw=rw+1;
     821   }
     822   return(rw);
     823}
     824example
     825{"EXAMPLE:";  echo = 2;
     826  ring r0 = 0,(x,y,z),dp;
     827  ringweights(r0);
     828  ring r1 = 0,x(1..5),(ds(3),wp(2,3));
     829  ringweights(r1);"";
     830  // an example for enlarging the ring, keeping the first weights:
     831  intvec v = ringweights(r1),6,2,3,4,5;
     832  ring R = 0,x(1..10),(a(v),dp);
     833  ordstr(R);
     834}
     835///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.