Changeset d7a7b6 in git for Singular/LIB


Ignore:
Timestamp:
Feb 23, 2009, 1:08:39 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
7924eecd41944b3878830cb230825ccae2e772ed
Parents:
182e83fadbf10f4510f28a284af732d6e1eeb25f
Message:
*hannes: .. in pmat, ticket 85


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/inout.lib

    r182e83 rd7a7b6  
    1 //(GMG/BM, last modified 22.06.96)
    2 //(GMG, last modified 21.07.2008: Argument von show von id in @@id geaendert)
    3 ///////////////////////////////////////////////////////////////////////////////
    4 version="$Id: inout.lib,v 1.31 2008-09-24 07:54:59 Singular Exp $";
     1// (GMG/BM, last modified 22.06.96)
     2///////////////////////////////////////////////////////////////////////////////
     3version="$Id: inout.lib,v 1.32 2009-02-23 12:08:39 Singular Exp $";
    54category="General purpose";
    65info="
     
    112111proc pmat (matrix m, list #)
    113112"USAGE:   pmat(M[,n]);  M matrix, n integer
    114 DISPLAY: display M in array format if it fits into pagewidth; if n is given,
    115          only the first n characters of each colum are shown
    116 RETURN:  no return value
     113RETURN: A string representing M in array format if it fits into
     114        pagewidth; if n is given, only the first n characters of
     115        each column are shown (n>1 required), where a truncation
     116        of a column is indicated by two dots (\'..\')
    117117EXAMPLE: example pmat; shows an example
    118118"
    119119{
    120120//------------- main case: input is a matrix, no second argument---------------
     121   string OUT = "";
    121122   if ( size(#)==0)
    122123   {
     
    144145            elems = elems + nrows(m);
    145146         }
    146          aus;
     147         OUT=OUT+aus+newline;
    147148      }
    148149   //--------------- print last row (no comma after last entry) ---------------
     
    154155      }
    155156      aus = aus + string(m[nrows(m),ncols(m)]);
    156       aus;  return();
     157      OUT=OUT+aus;  return(OUT);
    157158   }
    158159//---------- second case: second argument is given and of type int ------------
    159    if ( typeof(#[1])=="int" )
    160    {  string aus,tmp; int ll,c,r;
    161       for ( r=1; r<=nrows(m); r=r+1)
     160   if ( typeof(#[1])=="int" and #[1]>1)
     161   {  string aus,tmp; int c,r;
     162   //---------------------- print all - except last - rows --------------------
     163      for ( r=1; r<nrows(m); r=r+1)
    162164      {  aus = "";
    163165         for (c=1; c<=ncols(m); c=c+1)
    164166         {
    165167            tmp=string(m[r,c]);
    166             aus=aus+tmp[1,#[1]]+" ";
    167          }
    168          aus;
    169       }
    170       return();
     168            if (size(tmp)>#[1])
     169            { tmp[#[1]-1]=".";
     170              tmp[#[1]]  =".";
     171              aus=aus+tmp[1,#[1]]+", ";
     172            }
     173            else
     174            { tmp=tmp+",";
     175              aus=aus+tmp[1,#[1]+1]+" ";
     176            }
     177         }
     178         OUT=OUT+aus+newline;
     179      }
     180   //--------------- print last row (no comma after last entry) ---------------
     181      aus = "";
     182      for (c=1; c<ncols(m); c=c+1)
     183      { tmp=string(m[r,c]);
     184        if (size(tmp)>#[1])
     185        { tmp[#[1]-1]=".";
     186          tmp[#[1]]  =".";
     187          aus=aus+tmp[1,#[1]]+", ";
     188        }
     189        else
     190        { tmp=tmp+",";
     191          aus=aus+tmp[1,#[1]+1]+" ";
     192        }
     193      }
     194      tmp=string(m[nrows(m),ncols(m)]);
     195      if (size(tmp)>#[1])
     196      { tmp[#[1]-1]=".";
     197        tmp[#[1]]  =".";
     198      }
     199      aus = aus + tmp[1,#[1]];
     200      OUT=OUT+aus;  return(OUT);
    171201   }
    172202}
     
    177207   matrix m[3][3]=i^2;
    178208   pmat(m);
    179    pmat(m,3);
     209   pmat(m,5);
    180210}
    181211///////////////////////////////////////////////////////////////////////////////
     
    348378      }
    349379   }
    350 //----------------------- case: @@id is of type list -------------------------
     380//----------------------- case: @@id is of type list ----------------------------
    351381   if ( typeof(@@id)=="list" )
    352382   {
     
    457487      {
    458488         list na@me@s=names(@id@);
    459          //kill @id@;
     489         kill @id@;
    460490         @@s = tab(@li@)+"// ring:"; @@s,s;
    461491         @@s = tab(@li@)+"// minpoly ="; @@s,minpoly;
     
    535565///////////////////////////////////////////////////////////////////////////////
    536566
    537 proc showrecursive (id,poly p,list #)
     567proc showrecursive (@@id,poly p,list #)
    538568"USAGE:   showrecursive(id,p[,ord]); id= any object of basering, p= product of
    539569         variables and ord=string (any allowed ordstr)
     
    567597
    568598   execute("ring newP=("+newchar+"),("+newvar+"),("+neword+");");
    569    def id = imap(P,id);
    570    show(id);
     599   def @@id = imap(P,@@id);
     600   show(@@id);
    571601   return();
    572602}
Note: See TracChangeset for help on using the changeset viewer.