source: git/Tst/Short/gcd3test.tst @ f1cfef

spielwiese
Last change on this file since f1cfef 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: 704 bytes
Line 
1LIB "tst.lib";tst_init();
2proc test3 (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)^2 + x(2)^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, g2, f2;
15  for (i= 3; i <= 11; i++)
16  {
17    d= x(1)^i;
18    for (k= 2; k <= i; k++)
19    {
20      d= d + x(k)^i;
21    }
22    g2= d;
23    f2= d;
24    d= d + 1;
25    f2= f2 - 2;
26    g2= g2 + 2;
27    f= f2*d;
28    g= g2*d;
29    testgcd= gcd (f,g);
30    testgcd= testgcd/leadcoef (testgcd);
31    testgcd == d;
32  }
33}
34
35test3 (3);
36tst_status();
37test3 (43051);
38tst_status();
39test3 (0);
40tst_status();
41tst_status(1);
42$
Note: See TracBrowser for help on using the repository browser.