Changeset d7a7b6 in git
- Timestamp:
- Feb 23, 2009, 1:08:39 PM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 7924eecd41944b3878830cb230825ccae2e772ed
- Parents:
- 182e83fadbf10f4510f28a284af732d6e1eeb25f
- 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 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: inout.lib,v 1.32 2009-02-23 12:08:39 Singular Exp $"; 5 4 category="General purpose"; 6 5 info=" … … 112 111 proc pmat (matrix m, list #) 113 112 "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 113 RETURN: 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 (\'..\') 117 117 EXAMPLE: example pmat; shows an example 118 118 " 119 119 { 120 120 //------------- main case: input is a matrix, no second argument--------------- 121 string OUT = ""; 121 122 if ( size(#)==0) 122 123 { … … 144 145 elems = elems + nrows(m); 145 146 } 146 aus;147 OUT=OUT+aus+newline; 147 148 } 148 149 //--------------- print last row (no comma after last entry) --------------- … … 154 155 } 155 156 aus = aus + string(m[nrows(m),ncols(m)]); 156 aus; return();157 OUT=OUT+aus; return(OUT); 157 158 } 158 159 //---------- 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) 162 164 { aus = ""; 163 165 for (c=1; c<=ncols(m); c=c+1) 164 166 { 165 167 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); 171 201 } 172 202 } … … 177 207 matrix m[3][3]=i^2; 178 208 pmat(m); 179 pmat(m, 3);209 pmat(m,5); 180 210 } 181 211 /////////////////////////////////////////////////////////////////////////////// … … 348 378 } 349 379 } 350 //----------------------- case: @@id is of type list ------------------------- 380 //----------------------- case: @@id is of type list ---------------------------- 351 381 if ( typeof(@@id)=="list" ) 352 382 { … … 457 487 { 458 488 list na@me@s=names(@id@); 459 //kill @id@;489 kill @id@; 460 490 @@s = tab(@li@)+"// ring:"; @@s,s; 461 491 @@s = tab(@li@)+"// minpoly ="; @@s,minpoly; … … 535 565 /////////////////////////////////////////////////////////////////////////////// 536 566 537 proc showrecursive ( id,poly p,list #)567 proc showrecursive (@@id,poly p,list #) 538 568 "USAGE: showrecursive(id,p[,ord]); id= any object of basering, p= product of 539 569 variables and ord=string (any allowed ordstr) … … 567 597 568 598 execute("ring newP=("+newchar+"),("+newvar+"),("+neword+");"); 569 def id = imap(P,id);570 show( id);599 def @@id = imap(P,@@id); 600 show(@@id); 571 601 return(); 572 602 }
Note: See TracChangeset
for help on using the changeset viewer.