Changeset 45b1fd8 in tol
- Timestamp:
- Sep 19, 2012, 8:47:26 AM (14 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 04e6eaf
- Parents:
- 76571c9
- Location:
- tol/btol/polynomial_type
- Files:
-
- 2 edited
-
polgra.cpp (modified) (5 diffs)
-
tol_bpolgra.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/polynomial_type/polgra.cpp
r76571c9 r45b1fd8 502 502 BInt degree, 503 503 BInt period, 504 BDat minInvRootModule, 504 505 BDat maxInvRootModule) 505 506 //-------------------------------------------------------------------- … … 515 516 BPol factor; 516 517 if(maxInvRootModule>1-2*DEpsilon()) { maxInvRootModule = 1-2*DEpsilon(); } 517 else if(maxInvRootModule<0) { maxInvRootModule = 0; } 518 if(maxInvRootModule< 2*DEpsilon()) { maxInvRootModule = 2*DEpsilon(); } 519 if(minInvRootModule< 2*DEpsilon()) { minInvRootModule = 2*DEpsilon(); } 520 if(minInvRootModule>maxInvRootModule) 521 { 522 Error("[RandStationary] Cannot draw in empty interval ["+minInvRootModule+","+maxInvRootModule+"]"); 523 return(factor); 524 } 518 525 if(n1) 519 526 { 520 a = maxInvRootModule*u.Random(); 527 BDat ur = u.Random(); 528 a = maxInvRootModule*ur + minInvRootModule*(1-ur); 521 529 factor = B0-a*BP; 522 530 //Std(BText("\nRandStationary(")+degree+","+period+","+maxInvRootModule+") monome a="+a+"; factor="+factor.Name()); … … 544 552 ok = (a<1-b) && 545 553 (a<1+b) && 546 (m1<maxInvRootModule) && 547 (m2<maxInvRootModule); 554 (m1>=minInvRootModule) && 555 (m2>=minInvRootModule) && 556 (m1<=maxInvRootModule) && 557 (m2<=maxInvRootModule); 548 558 if(ok) 549 559 { … … 559 569 //-------------------------------------------------------------------- 560 570 DeclareContensClass(BPol, BPolTemporary, BPolRandStationary); 561 DefExtOpr(1, BPolRandStationary, "RandStationary", 1, 3, 562 "Real Real Real", 563 "(Real d [, Real p = 1, Real maxInvRootModule = 0.999999])", 571 DefExtOpr(1, BPolRandStationary, "RandStationary", 1, 4, 572 "Real Real Real Real", 573 "(Real d [, Real p = 1, " 574 "Real minInvRootModule = 0.000001, " 575 "Real maxInvRootModule = 0.999999])", 564 576 I2("Returns a random stationary polinomial as \n", 565 577 "Devuelve un polinomio estacionario aleatorio de la forma \n") + … … 572 584 BInt degree = (BInt)Real(Arg(1)); 573 585 BInt period = 1; 586 BDat minInvRootModule = .000001; 574 587 BDat maxInvRootModule = .999999; 575 588 if(Arg(2)) { period = (BInt)Real(Arg(2)); } 576 if(Arg(3)) { maxInvRootModule = Dat(Arg(3)); } 577 contens_ = RandStationary(degree, period, maxInvRootModule); 589 if(Arg(3)) { minInvRootModule = Dat(Arg(3)); } 590 if(Arg(4)) { maxInvRootModule = Dat(Arg(4)); } 591 contens_ = RandStationary(degree, period, minInvRootModule, maxInvRootModule); 578 592 } 579 593 -
tol/btol/polynomial_type/tol_bpolgra.h
r76571c9 r45b1fd8 44 44 BInt degree, 45 45 BInt period, 46 BDat minInvRootModule=.000001, 46 47 BDat maxInvRootModule=.999999); 47 48
Note: See TracChangeset
for help on using the changeset viewer.
