Changeset 4de1db in git
- Timestamp:
- Jan 19, 2011, 7:09:50 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 93134ce8b1735ff9eee324c4ecb029187ba24c08
- Parents:
- 8c097e100503580a34ad9e198d2f1c1adaad7576
- Location:
- Singular/LIB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
r8c097e r4de1db 797 797 module( M[ sort(lead(M), "c,dp")[2] ] ); 798 798 sort( M, sort(lead(M), "c,dp")[2] )[1]; 799 800 // BUG: Please, don't use this sort for integer vectors or lists 801 // with them if there can be negative integers! 802 // TODO: for some HiWi 803 sort(3..-3)[1]; 804 sort(list(-v, v))[1]; 805 799 806 } 800 807 /////////////////////////////////////////////////////////////////////////////// -
Singular/LIB/homolog.lib
r8c097e r4de1db 497 497 intvec A1,A2,A3; 498 498 int s = size(v); 499 intvec v1 = sort(v)[1]; 500 max = v1[s]; // the maximum integer occurring in intvec v 499 max = Max(v); // the maximum integer occurring in intvec v 501 500 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 502 501 // --------------- Variante mit sres … … 810 809 intmat Be; 811 810 int s = size(v); 812 intvec v1 = sort(v)[1]; 813 max = v1[s]; // the maximum integer occurring in intvec v 811 max = Max(v); // the maximum integer occurring in intvec v 814 812 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 815 813 //---------- test: coker(N)=basering, coker(N)=0 ? ---------------------------- … … 1294 1292 intmat Be; 1295 1293 int s = size(v); 1296 intvec v1 = sort(v)[1]; 1297 max = v1[s]; // maximum integer occurring in intvec v 1294 max = Max(v); // maximum integer occurring in intvec v 1298 1295 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 1299 1296 … … 1929 1926 } 1930 1927 1928 // taken from qhmoduli.lib 1929 static proc Max(data) 1930 "USAGE: Max(data); intvec/list of integers 1931 PURPOSE: find the maximal integer contained in 'data' 1932 RETURN: list 1933 ASSUME: 'data' contians only integers and is not empty 1934 " 1935 { 1936 int i; 1937 int max = data[1]; 1938 1939 for(i = size(data); i>1;i--) 1940 { 1941 if(data[i] > max) { max = data[i]; } 1942 } 1943 return(max); 1944 } 1945 example 1946 {"EXAMPLE:"; echo = 2; 1947 Max(list(1,2,3)); 1948 }
Note: See TracChangeset
for help on using the changeset viewer.