Changeset 65546eb in git for Singular/LIB


Ignore:
Timestamp:
Jan 16, 2001, 2:03:54 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
49bec69100d73ab84e1edda6408fd13e13cd5ab0
Parents:
f01a1ae78d8a706cd6d590585b8a8a76a80cad52
Message:
*hannes: spaces/tabs


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    rf01a1a r65546eb  
    22//anne, added deleteSublist and watchdog 12.12.2000
    33///////////////////////////////////////////////////////////////////////////////
    4 version="$Id: general.lib,v 1.37 2001-01-11 12:04:17 pfister Exp $";
     4version="$Id: general.lib,v 1.38 2001-01-16 13:03:54 Singular Exp $";
    55category="General purpose";
    66info="
     
    419419@*       - killall(\"not\", \"type_name\"); kills all user-defined variables,
    420420           except those of type \"type_name\" and except loaded procedures
    421 @*       - killall(\"not\", \"name_1\", \"name_2\", ...); 
    422            kills all user-defined variables, except those of name \"name_i\" 
     421@*       - killall(\"not\", \"name_1\", \"name_2\", ...);
     422           kills all user-defined variables, except those of name \"name_i\"
    423423           and except loaded procedures
    424424NOTE:    killall should never be used inside a procedure
     
    435435    }
    436436  }
    437  
     437
    438438  // kills all user-defined variables but not loaded procedures
    439439  if( size(#)==0 )
     
    441441    for ( @joni=size(@marie); @joni>0; @joni-- )
    442442    {
    443       if( @marie[@joni]!="LIB" and typeof(`@marie[@joni]`)!="proc" ) 
     443      if( @marie[@joni]!="LIB" and typeof(`@marie[@joni]`)!="proc" )
    444444      { kill `@marie[@joni]`; }
    445445    }
     
    455455        for ( @joni=size(@marie); @joni>0; @joni-- )
    456456        {
    457           if((@marie[@joni]!="killall") and (@marie[@joni]=="LIB" or 
     457          if((@marie[@joni]!="killall") and (@marie[@joni]=="LIB" or
    458458                                       typeof(`@marie[@joni]`)=="proc"))
    459459          { kill `@marie[@joni]`; }
     
    461461      }
    462462      else
    463       { 
     463      {
    464464        // other types
    465465        for ( @joni=size(@marie); @joni>2; @joni-- )
    466466        {
    467           if(typeof(`@marie[@joni]`)==#[1] and @marie[@joni]!="LIB" 
    468              and typeof(`@marie[@joni]`)!="proc") 
     467          if(typeof(`@marie[@joni]`)==#[1] and @marie[@joni]!="LIB"
     468             and typeof(`@marie[@joni]`)!="proc")
    469469          { kill `@marie[@joni]`; }
    470470        }
     
    473473    else
    474474    {
    475       // kills all user-defined variables whose name or type is not #i 
     475      // kills all user-defined variables whose name or type is not #i
    476476      for ( @joni=size(@marie); @joni>2; @joni-- )
    477477      {
     
    654654          v intvec  (default: v=1..number of entries of id)
    655655ASSUME:   list members can be multiplied.
    656 RETURN:   The product of all entries of id [with index given by v] of type 
     656RETURN:   The product of all entries of id [with index given by v] of type
    657657          depending on the entries of id.
    658658NOTE:     If id is not a list, id is treated as a list of polys resp. integers.
     
    663663EXAMPLE:  example product; shows an example
    664664"
    665 { 
     665{
    666666//-------------------- initialization and special feature ---------------------
    667667   int n,j,tt;
    668    string ty;                                         //will become type of id
     668   string ty;                                //will become type of id
    669669   list l;
    670670
    671671// We wish to allow something like product(x(1..10)) if x(1),...,x(10) are
    672 // variables. x(1..10) is a list of polys and enters the procedure with 
     672// variables. x(1..10) is a list of polys and enters the procedure with
    673673// id=x(1) and # a list with 9 polys, #[1]= x(2),...,#[9]= x(10). Hence, in
    674674// this case # is never empty. If an additional intvec v is given,
     
    678678   int s = size(#);
    679679   if( s!=0 )
    680    {  if ( typeof(#[s])=="intvec" or typeof(#[s])=="int")   
    681       { 
     680   {  if ( typeof(#[s])=="intvec" or typeof(#[s])=="int")
     681      {
    682682         intvec v = #[s];
    683          tt=1; 
     683         tt=1;
    684684         s=s-1;
    685685         if ( s>0 ) { # = #[1..s]; }
     
    695695   }
    696696   else
    697    { 
     697   {
    698698      ty = typeof(id);
    699       if( ty == "list" ) 
     699      if( ty == "list" )
    700700      { n = size(id); }
    701701   }
     
    716716      kill id;
    717717      intvec id = i;                                  //case: id = intvec
    718       n = size(id); 
     718      n = size(id);
    719719   }
    720720//--------------- consider intvec v and empty product  -----------------------
    721    if( tt!=0 ) 
     721   if( tt!=0 )
    722722   {
    723723      for (j=1; j<=size(v); j++)
    724724      {
    725725         if ( v[j] <= 0 or v[j] > n )                 //v outside range of id
    726          { 
     726         {
    727727            return(1);                                //empty product is 1
    728          }                               
     728         }
    729729      }
    730730      id = id[v];                                     //consider part of id
     
    739739   }
    740740//-------------------------- finally, multiply objects  -----------------------
    741    n = size(id); 
     741   n = size(id);
    742742   def f(1) = id[1];
    743743   for( j=2; j<=n; j=j+1 ) { def f(j)=f(j-1)*id[j]; }
     
    885885   ideal i = x3,z3,xyz;
    886886   sort(i);            //sorts using lex ordering, smaller polys come first
    887  
     887
    888888   sort(i,3..1);
    889889
     
    900900          v intvec  (default: v=1..number of entries of id)
    901901ASSUME:   list members can be added.
    902 RETURN:   The sum of all entries of id [with index given by v] of type 
     902RETURN:   The sum of all entries of id [with index given by v] of type
    903903          depending on the entries of id.
    904904NOTE:     If id is not a list, id is treated as a list of polys resp. integers.
     
    916916
    917917// We wish to allow something like sum(x(1..10)) if x(1),...,x(10) are
    918 // variables. x(1..10) is a list of polys and enters the procedure with 
     918// variables. x(1..10) is a list of polys and enters the procedure with
    919919// id=x(1) and # a list with 9 polys, #[1]= x(2),...,#[9]= x(10). Hence, in
    920920// this case # is never empty. If an additional intvec v is given,
     
    926926   {  if ( typeof(#[s])=="intvec" or typeof(#[s])=="int")
    927927      {  intvec v = #[s];
    928          tt=1; 
     928         tt=1;
    929929         s=s-1;
    930930         if ( s>0 ) { # = #[1..s]; }
     
    939939   }
    940940   else
    941    { 
     941   {
    942942      ty = typeof(id);
    943943   }
     
    959959   }
    960960//------------------- consider intvec v and empty sum  -----------------------
    961    if( tt!=0 ) 
     961   if( tt!=0 )
    962962   {
    963963      for (j=1; j<=size(v); j++)
    964964      {
    965965         if ( v[j] <= 0 or v[j] > size(id) )         //v outside range of id
    966          { 
     966         {
    967967            return(0);                               //empty sum is 0
    968          }                               
     968         }
    969969      }
    970970      id = id[v];                                    //consider part of id
     
    972972
    973973//-------------------------- finally, add objects  ---------------------------
    974    n = size(id); 
     974   n = size(id);
    975975   def f(1) = id[1];
    976976   for( j=2; j<=n; j=j+1 ) { def f(j)=f(j-1)+id[j]; }
     
    10551055         the string "Killed" is returned and the global variable
    10561056         'watchdog_interrupt' is defined.
    1057 NOTE:    * the MP package must be enabled 
    1058          * the current basering should not be watchdog_rneu, since 
     1057NOTE:    * the MP package must be enabled
     1058         * the current basering should not be watchdog_rneu, since
    10591059           watchdog_rneu will be killed
    10601060         * if there are variable names of the structure x(i) all
     
    10771077      int j=10;
    10781078      int k=999999;
    1079 // fork, get the pid of the child and send it the command   
     1079// fork, get the pid of the child and send it the command
    10801080      link l_fork="MPtcp:fork";
    10811081      open(l_fork);
     
    11381138    }
    11391139    ERROR("MP-support is not enabled in this version of Singular.");
    1140   } 
     1140  }
    11411141}
    11421142example
Note: See TracChangeset for help on using the changeset viewer.