spielwiese
Last change
on this file since 5ebd4bc was
60cc12,
checked in by Martin Lee <martinlee84@…>, 12 years ago
|
chg: added new tests for gcd from http://home.bway.net/lewis/fermat/gcdcomp
and "Evaluation of the Heuristic Polynomial GCD"
|
-
Property mode set to
100644
|
File size:
755 bytes
|
Rev | Line | |
---|
[60cc12] | 1 | LIB "tst.lib";tst_init(); |
---|
| 2 | proc test3prim (int p) |
---|
| 3 | { |
---|
| 4 | ring r= p, x(1..11), dp; |
---|
| 5 | poly d1= x(1)^2 + x(2)^2 + 1; |
---|
| 6 | poly f1= x(1)^2 - x(2)^2 - 2; |
---|
| 7 | poly g1= x(1) + x(2) + 2; |
---|
| 8 | poly f= d1*f1; |
---|
| 9 | poly g= d1*g1; |
---|
| 10 | poly testgcd= gcd (f,g); |
---|
| 11 | testgcd= testgcd/leadcoef (testgcd); |
---|
| 12 | testgcd == d1; |
---|
| 13 | int i, k; |
---|
| 14 | poly d, f2, g2; |
---|
| 15 | for (i= 3; i <= 11; i++) |
---|
| 16 | { |
---|
| 17 | d= x(1)^i; |
---|
| 18 | g2= x(1)^(i-1); |
---|
| 19 | for (k= 2; k <= 11; k++) |
---|
| 20 | { |
---|
| 21 | d= d + x(k)^i; |
---|
| 22 | g2= g2 + x(k)^(i - 1); |
---|
| 23 | } |
---|
| 24 | f2= d; |
---|
| 25 | d= d + 1; |
---|
| 26 | f2= f2 - 2; |
---|
| 27 | g2= g2 + 2; |
---|
| 28 | f= f2*d; |
---|
| 29 | g= g2*d; |
---|
| 30 | testgcd= gcd (f,g); |
---|
| 31 | testgcd= testgcd/leadcoef (testgcd); |
---|
| 32 | testgcd == d; |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | test3prim (3); |
---|
| 37 | tst_status(); |
---|
| 38 | test3prim (43051); |
---|
| 39 | tst_status(); |
---|
| 40 | test3prim (0); |
---|
| 41 | tst_status(); |
---|
| 42 | tst_status(1); |
---|
| 43 | $ |
---|
Note: See
TracBrowser
for help on using the repository browser.