spielwiese
Last change
on this file since 287cc8 was
287cc8,
checked in by Hans Schönemann <hannes@…>, 14 years ago
|
ntl 5.5.2
git-svn-id: file:///usr/local/Singular/svn/trunk@12402 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1003 bytes
|
Line | |
---|
1 | #include <NTL/ZZXFactoring.h> |
---|
2 | |
---|
3 | NTL_CLIENT |
---|
4 | |
---|
5 | long NumFacs(const vec_pair_ZZX_long& v) |
---|
6 | { |
---|
7 | long i; |
---|
8 | long res; |
---|
9 | |
---|
10 | res = 0; |
---|
11 | |
---|
12 | for (i = 0; i < v.length(); i++) |
---|
13 | res += v[i].b; |
---|
14 | |
---|
15 | return res; |
---|
16 | } |
---|
17 | |
---|
18 | |
---|
19 | int main() |
---|
20 | { |
---|
21 | long cnt = 0; |
---|
22 | while (SkipWhiteSpace(cin)) { |
---|
23 | cnt++; |
---|
24 | cerr << "."; |
---|
25 | |
---|
26 | vec_ZZ w; |
---|
27 | ZZX f1, f; |
---|
28 | long nfacs; |
---|
29 | |
---|
30 | cin >> w; |
---|
31 | cin >> nfacs; |
---|
32 | |
---|
33 | long i, n; |
---|
34 | n = w.length(); |
---|
35 | f.rep.SetLength(n); |
---|
36 | for (i = 0; i < n; i++) |
---|
37 | f.rep[i] = w[n-1-i]; |
---|
38 | f.normalize(); |
---|
39 | |
---|
40 | vec_pair_ZZX_long factors; |
---|
41 | ZZ c; |
---|
42 | |
---|
43 | factor(c, factors, f, 0); |
---|
44 | |
---|
45 | |
---|
46 | mul(f1, factors); |
---|
47 | mul(f1, f1, c); |
---|
48 | |
---|
49 | if (f != f1) { |
---|
50 | cerr << f << "\n"; |
---|
51 | cerr << c << " " << factors << "\n"; |
---|
52 | Error("FACTORIZATION INCORRECT (1) !!!"); |
---|
53 | } |
---|
54 | |
---|
55 | long nfacs1 = NumFacs(factors); |
---|
56 | |
---|
57 | if (nfacs1 != nfacs) |
---|
58 | Error("FACTORIZATION INCORRECT (2) !!!"); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | cerr << "\n"; |
---|
63 | cerr << "MoreFacTest OK\n"; |
---|
64 | |
---|
65 | return 0; |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.