Changeset 45f7bf in git
- Timestamp:
- May 24, 1998, 5:50:29 PM (25 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 6149f4fc52e4155e098c88eb317a7abd5b8d6541
- Parents:
- 3bb3e6aa8f77d610b72ac96bb897600802300029
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/standard.lib
r3bb3e6a r45f7bf 1 // $Id: standard.lib,v 1.1 1 1998-05-18 13:24:50 SingularExp $1 // $Id: standard.lib,v 1.12 1998-05-24 15:50:27 obachman Exp $ 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 4 version="$Id: standard.lib,v 1.1 1 1998-05-18 13:24:50 SingularExp $";4 version="$Id: standard.lib,v 1.12 1998-05-24 15:50:27 obachman Exp $"; 5 5 info=" 6 6 LIBRARY: standard.lib PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP … … 8 8 stdfglm(ideal[,ord]) standard basis of the ideal via fglm [and ordering ord] 9 9 stdhilb(ideal) standard basis of the ideal using the Hilbert function 10 groebner(ideal/module) standard basis of ideal or module using a 11 heuristically choosen method 10 12 "; 11 13 … … 122 124 /////////////////////////////////////////////////////////////////////////////// 123 125 126 proc groebner(def i, list #) 127 "USAGE: groebner(i) i ideal/module 128 RETURNS: standard basis of ideal or module which is computed using a 129 heuristically choosen method: 130 If the ordering of the current ring is a lokal ordering, or 131 if it is a non-block ordering and the current ring has no 132 parameters, then std(i) is returned. 133 Otherwise, i is mapped into a ring with no parameters and 134 ordering dp, where its Hilbert series is computed. This is 135 followed by a Hilbert-series based std computation in the 136 original ring. 137 EXAMPLE: example groebner; shows an example" 138 { 139 def P=basering; 140 if (size(#) > 0) 141 { 142 if (system("with", "MP")) 143 { 144 if (typeof(#[1]) == "int") 145 { 146 int wait = #[1]; 147 int j, pid; 148 string bs = nameof(basering); 149 link l_fork = "MPtcp:fork"; 150 open(l_fork); 151 write(l_fork, quote(system("pid"))); 152 pid = read(l_fork); 153 write(l_fork, quote(groebner(eval(i)))); 154 155 for (j=0; j<wait; j++) 156 { 157 if (status(l_fork, "read", "ready", 1)) {break;} 158 } 159 160 if (status(l_fork, "read", "ready")) 161 { 162 def result = read(l_fork); 163 if (bs != nameof(basering)) 164 { 165 def PP = basering; 166 setring P; 167 def result = imap(PP, result); 168 kill PP; 169 } 170 kill (l_fork); 171 } 172 else 173 { 174 ideal result; 175 if (! defined(groebner_error)) 176 { 177 int groebner_error; 178 export groebner_error; 179 } 180 groebner_error = 1; 181 "// ** groebner did not finish"; 182 j = system("sh", "kill " + string(pid)); 183 } 184 return (result); 185 } 186 else 187 { 188 "// ** groebner needs int as 2nd arg"; 189 } 190 } 191 else 192 { 193 "// ** groebner with two args not supported in this configuration"; 194 } 195 } 196 string ordstr_P = ordstr(P); 197 198 if (find(ordstr_P,"s") > 0) 199 { 200 //spaeter den lokalen fall ueber lp oder aehnlich behandeln 201 return(std(i)); 202 } 203 204 int IsSimple_P; 205 if (system("nblocks") <= 2) 206 { 207 if (find(ordstr_P, "M") <= 0) 208 { 209 IsSimple_P = 1; 210 } 211 } 212 int npars_P = npars(P); 213 214 // return std if no parameters and (dp or wp) 215 if ((npars_P == 0) && IsSimple_P) 216 { 217 if (find(ordstr_P, "d") > 0) 218 { 219 return (std(i)); 220 } 221 if (find(ordstr_P,"w") > 0) 222 { 223 return (std(i)); 224 } 225 } 226 227 // reset options 228 intvec opt=option(get); 229 int p_opt; 230 string s_opt = option(); 231 option(none); 232 // turn on option(prot) and/or option(mem), if previously set 233 if (find(s_opt, "prot")) 234 { 235 option(prot); 236 p_opt = 1; 237 } 238 if (find(s_opt, "mem")) 239 { 240 option(mem); 241 } 242 243 // construct ring in which first std computation is done 244 string varstr_P = varstr(P); 245 string parstr_P = parstr(P); 246 int is_homog = (homog(i) && (npars_P == 0)); 247 248 string ri = "ring Phelp =" + string(char(P)) + ",(" + varstr_P; 249 // parameters are converted to ring variables 250 if (npars_P > 0) 251 { 252 ri = ri + "," + parstr_P; 253 } 254 // a homogenizing variable is added, if necessary 255 if (! is_homog) 256 { 257 ri = ri + ",@t"; 258 } 259 // ordering is set to (dp, C) 260 ri = ri + "),(dp,C);"; 261 262 // change the ring 263 execute(ri); 264 265 // get ideal from previous ring 266 if (is_homog) 267 { 268 ideal qh = imap(P, i); 269 } 270 else 271 { 272 // and homogenize 273 ideal qh=homog(imap(P,i),@t); 274 } 275 276 // compute std and hilbert series 277 if (p_opt) 278 { 279 "std in " + ri[13, size(ri) - 13]; 280 } 281 ideal qh1=std(qh); 282 intvec hi=hilb(qh1,1); 283 284 if (is_homog && (npars_P == 0)) 285 { 286 // no additional variables were introduced 287 setring P; // can immediately change to original ring 288 // simply compute std with hilbert series in original ring 289 if (p_opt) 290 { 291 "std with hilb in basering"; 292 i = std(i, hi); 293 } 294 } 295 else 296 { 297 // additional variables were introduced 298 // need another intermediate ring 299 ri = "ring Phelp1 =" + string(char(P)) 300 + ",(" + varstr(Phelp) + "),(" + ordstr_P; 301 302 // for lp without parameters, we do not need a block ordering 303 if ( ! (IsSimple_P && (npars_P + is_homog < 2) && find(ordstr_P, "l"))) 304 { 305 // need block ordering 306 ri = ri + ", dp(" + string(npars_P + is_homog) + ")"; 307 } 308 ri = ri + ");"; 309 310 // change to intermediate ring 311 execute(ri); 312 ideal qh = imap(Phelp, qh); 313 kill Phelp; 314 if (p_opt) 315 { 316 "std with hilb in " + ri[14,size(ri)-14]; 317 } 318 // compute std with Hilbert series 319 qh = std(qh, hi); 320 // subst 1 for homogenizing var 321 if (!is_homog) 322 { 323 qh = subst(qh, @t, 1); 324 } 325 326 // go back to original ring 327 setring P; 328 // get ideal, delete zeros and clean SB 329 i = imap(Phelp1,qh); 330 i = simplify(i, 34); 331 kill Phelp1; 332 } 333 334 // clean-up time 335 option(set, opt); 336 if (find(s_opt, "redSB") > 0) 337 { 338 i=interred(i); 339 } 340 attrib(i, "isSB", 1); 341 return (i); 342 } 343 example 344 { 345 "EXAMPLE: "; echo = 2; 346 ring r = 0, (a,b,c,d), lp; 347 option(prot); 348 ideal i = a+b+c+d, ab+ad+bc+cd, abc+abd+acd+bcd, abcd-1; // cyclic 4 349 groebner(i); 350 ring rp = (0, a, b), (c,d), lp; 351 ideal i = imap(r, i); 352 ideal j = groebner(i); 353 option(noprot); 354 j; simplify(j, 1); std(i); 355 } 356 -
Singular/configure
r3bb3e6a r45f7bf 3419 3419 fi 3420 3420 3421 for ac_func in gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep 3421 for ac_func in gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep usleep 3422 3422 do 3423 3423 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -
Singular/configure.in
r3bb3e6a r45f7bf 429 429 AC_TYPE_SIGNAL 430 430 AC_FUNC_VPRINTF 431 AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep )431 AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep usleep) 432 432 433 433 dnl -
Singular/iparith.cc
r3bb3e6a r45f7bf 4319 4319 return TRUE; 4320 4320 jjSTATUS3(res, v, v->next, v->next->next); 4321 #if def HAVE_SLEEP4321 #if defined(HAVE_USLEEP) 4322 4322 if (((int) res->data) == 0) 4323 4323 { 4324 sleep((int) v->next->next->next->Data()); 4325 jjSTATUS3(res, v, v->next, v->next->next); 4324 int i_s = (int) v->next->next->next->Data(); 4325 if (i_s > 0) 4326 { 4327 usleep((int) v->next->next->next->Data()); 4328 jjSTATUS3(res, v, v->next, v->next->next); 4329 } 4330 } 4331 #elif defined(HAVE_SLEEP) 4332 if (((int) res->data) == 0) 4333 { 4334 int i_s = (int) v->next->next->next->Data(); 4335 if (i_s > 0) 4336 { 4337 sleep((is - 1)/1000000 + 1); 4338 jjSTATUS3(res, v, v->next, v->next->next); 4339 } 4326 4340 } 4327 4341 #endif -
Singular/mod2.h.in
r3bb3e6a r45f7bf 75 75 /* Define if you have readlink */ 76 76 #undef HAVE_READLINK 77 /* Define if you have usleep */ 78 #undef HAVE_USLEEP 77 79 /* Define if you have sleep */ 78 80 #undef HAVE_SLEEP
Note: See TracChangeset
for help on using the changeset viewer.