Changeset 4ff391 in git for Singular/LIB/random.lib
 Timestamp:
 Mar 30, 2009, 8:36:35 PM (14 years ago)
 Branches:
 (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
 Children:
 a9cdc23ba58cef8d67929bf916ec3db5a288899c
 Parents:
 6004f47987cad94bd0a8f07aac4035bb04fa0685
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/random.lib
r6004f4 r4ff391 1 1 //(GMG/BM, last modified 22.06.96) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: random.lib,v 1.1 7 20060720 15:19:35 SingularExp $";3 version="$Id: random.lib,v 1.18 20090330 18:36:35 motsak Exp $"; 4 4 category="General purpose"; 5 5 info=" … … 15 15 sparsepoly(u[,o,p,b]); random sparse polynomial with terms of degree in [u,o] 16 16 sparsetriag(n,m[,.]); nxm sparse lowertriag intmat with random coefficients 17 sparseHomogIdeal(k,u,[,.]); ideal with k sparse homogeneous generators of degree in [u, o] 17 18 triagmatrix(n,m,o[,.]); nxm sparse lowertriag matrix of poly's of degree<=o 18 19 randomLast(b); random transformation of the last variable … … 149 150 sparseid(3,0,4,90,9); 150 151 } 152 153 /////////////////////////////////////////////////////////////////////////////// 154 proc sparseHomogIdeal (int k, int u, list #) 155 "USAGE: sparseid(k,u[,o,p,b]); k,u,o,p,b integers 156 RETURN: ideal having k homogeneous generators, each of random degree in the 157 interval [u,o], p percent of terms in degree d are 0, the remaining 158 have random coefficients in the interval [1,b], (default: o=u, p=75, 159 b=30000) 160 EXAMPLE: example sparseid; shows an example 161 " 162 { 163 // set defaults  164 if( size(#)>=3 ) { int o=#[1]; int p=#[2]; int b=#[3]; } 165 if( size(#)==2 ) { int o=#[1]; int p=#[2]; int b=30000; } 166 if( size(#)==1 ) { int o=#[1]; int p=75; int b=30000; } 167 if( size(#)==0 ) { int o=u; int p=75; int b=30000; } 168 // use sparsemat for creation of sparseid  169 int ii; ideal i; intmat m; ideal id; 170 171 for ( ii=k; ii>0; ii=ii1) 172 { 173 id = maxideal(random(u, o)); // monomial basis of some degree 174 m = sparsemat(size(id),1,p,b); // random coefficients 175 i[ii] = (matrix(id)*m)[1,1]; 176 } 177 return(i); 178 } 179 example 180 { "EXAMPLE:"; echo = 2; 181 ring r = 0,(a,b,c,d),dp; 182 sparseHomogIdeal(2,3);""; 183 sparseHomogIdeal(3,0,4,90,9); 184 } 185 186 151 187 /////////////////////////////////////////////////////////////////////////////// 152 188
Note: See TracChangeset
for help on using the changeset viewer.