1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facNTLzzpEXGCD.h |
---|
5 | * |
---|
6 | * @note the following code is slightly modified code out of |
---|
7 | * lzz_pEX.h from Victor Shoup's NTL. Below is NTL's copyright notice. |
---|
8 | * |
---|
9 | * This file defines functions for univariate GCD and extended GCD |
---|
10 | * over Z/p[t]/(f)[x] for reducible f |
---|
11 | * |
---|
12 | * ABSTRACT: Langemyr, McCallum "The Computation of Polynomial Greatest Common |
---|
13 | * Divisors over an algebraic number fields" |
---|
14 | * |
---|
15 | * @author Martin Lee |
---|
16 | * |
---|
17 | **/ |
---|
18 | /*****************************************************************************/ |
---|
19 | |
---|
20 | /** |
---|
21 | COPYRIGHT NOTICE |
---|
22 | for NTL 5.5 |
---|
23 | (modified for Singular 2-0-6 - 3-1) |
---|
24 | |
---|
25 | NTL -- A Library for Doing Number Theory |
---|
26 | Copyright (C) 1996-2009 Victor Shoup |
---|
27 | |
---|
28 | The most recent version of NTL is available at http://www.shoup.net |
---|
29 | |
---|
30 | This program is free software; you can redistribute it and/or |
---|
31 | modify it under the terms of the GNU General Public License |
---|
32 | as published by the Free Software Foundation; either version 2 |
---|
33 | of the License, or (at your option) any later version. |
---|
34 | |
---|
35 | This program is distributed in the hope that it will be useful, |
---|
36 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
37 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
38 | GNU General Public License for more details. |
---|
39 | |
---|
40 | You should have received a copy of the GNU General Public License |
---|
41 | along with this program; if not, write to the Free Software |
---|
42 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
43 | |
---|
44 | This entire copyright notice should be placed in an appropriately |
---|
45 | conspicuous place accompanying all distributions of software that |
---|
46 | make use of NTL. |
---|
47 | |
---|
48 | The above terms apply to all of the software modules distributed with NTL, |
---|
49 | i.e., all source files in either the ntl-xxx.tar.gz or WinNTL-xxx.zip |
---|
50 | distributions. In general, the individual files do not contain |
---|
51 | copyright notices. |
---|
52 | |
---|
53 | Note that the quad_float package is derived from the doubledouble package, |
---|
54 | originally developed by Keith Briggs, and also licensed unger the GNU GPL. |
---|
55 | The files quad_float.c and quad_float.h contain more detailed copyright |
---|
56 | notices. |
---|
57 | |
---|
58 | Note that the traditional long integer package used by NTL, lip.c, is derived |
---|
59 | from---and represents an extensive modification of--- |
---|
60 | a package originally developed and copyrighted by Arjen Lenstra, |
---|
61 | who has agreed to renounce any copyright claims on the particular |
---|
62 | version of the long integer package appearing in NTL, so that the |
---|
63 | this package now is covered by the GNU GPL as well. |
---|
64 | |
---|
65 | Note that the alternative long integer package used by NTL is GMP, |
---|
66 | which is written by Torbjorn Granlund <tege@swox.com>. |
---|
67 | GMP is licensed under the terms of the GNU Lesser General Public License. |
---|
68 | |
---|
69 | Note that NTL makes use of the RSA Data Security, Inc. MD5 Message |
---|
70 | Digest Algorithm. |
---|
71 | |
---|
72 | Note that prior to version 4.0, NTL was distributed under the following terms: |
---|
73 | NTL is freely available for research and educational purposes. |
---|
74 | I don't want to attach any legalistic licensing restrictions on |
---|
75 | users of NTL. |
---|
76 | However, NTL should not be linked in a commercial program |
---|
77 | (although using data in a commercial |
---|
78 | product produced by a program that used NTL is fine). |
---|
79 | |
---|
80 | The hope is that the GNU GPL is actually less restrictive than these |
---|
81 | older terms; however, in any circumstances such that GNU GPL is more |
---|
82 | restrictive, then the following rule is in force: |
---|
83 | versions prior to 4.0 may continue to be used under the old terms, |
---|
84 | but users of versions 4.0 or later should adhere to the terms of the GNU GPL. |
---|
85 | **/ |
---|
86 | |
---|
87 | |
---|
88 | #ifndef FAC_NTL_ZZ_PEX_GCD_H |
---|
89 | #define FAC_NTL_ZZ_PEX_GCD_H |
---|
90 | |
---|
91 | // #include "config.h" |
---|
92 | |
---|
93 | #ifdef HAVE_NTL |
---|
94 | #include "NTLconvert.h" |
---|
95 | #endif |
---|
96 | |
---|
97 | #ifdef HAVE_NTL |
---|
98 | /// compute the GCD x of a and b, fail is set to true if a zero divisor is |
---|
99 | /// encountered |
---|
100 | void tryNTLGCD(zz_pEX& x, ///<[in,out] GCD of a and b |
---|
101 | const zz_pEX& a,///<[in] s.a. |
---|
102 | const zz_pEX& b,///<[in] s.a. |
---|
103 | bool& fail ///<[in,out] s.a. |
---|
104 | ); |
---|
105 | |
---|
106 | /// compute the extended GCD d=s*a+t*b, fail is set to true if a zero divisor is |
---|
107 | /// encountered |
---|
108 | void tryNTLXGCD(zz_pEX& d, ///<[in,out] GCD of a and b |
---|
109 | zz_pEX& s, ///<[in,out] s. a. |
---|
110 | zz_pEX& t, ///<[in,out] s. a. |
---|
111 | const zz_pEX& a,///<[in] s. a. |
---|
112 | const zz_pEX& b,///<[in] s. a. |
---|
113 | bool& fail ///<[in,out] s. a. |
---|
114 | ); |
---|
115 | #endif |
---|
116 | |
---|
117 | #endif |
---|