 |
My Project
debian-1:4.1.1-p2+ds-4build2
|
#include "config.h"
#include "timing.h"
#include "cf_assert.h"
#include "debug.h"
#include "cf_defs.h"
#include "canonicalform.h"
#include "cf_iter.h"
#include "cf_reval.h"
#include "cf_primes.h"
#include "cf_algorithm.h"
#include "cfEzgcd.h"
#include "cfGcdAlgExt.h"
#include "cfSubResGcd.h"
#include "cfModGcd.h"
#include <NTL/ZZX.h>
#include "NTLconvert.h"
Go to the source code of this file.
|
bool | isPurePoly (const CanonicalForm &) |
|
void | out_cf (const char *s1, const CanonicalForm &f, const char *s2) |
| cf_algorithm.cc - simple mathematical algorithms. More...
|
|
static CanonicalForm | icontent (const CanonicalForm &f, const CanonicalForm &c) |
| static CanonicalForm icontent ( const CanonicalForm & f, const CanonicalForm & c ) More...
|
|
CanonicalForm | icontent (const CanonicalForm &f) |
| CanonicalForm icontent ( const CanonicalForm & f ) More...
|
|
CanonicalForm | gcd_poly (const CanonicalForm &f, const CanonicalForm &g) |
| CanonicalForm gcd_poly ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
static CanonicalForm | cf_content (const CanonicalForm &f, const CanonicalForm &g) |
| static CanonicalForm cf_content ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
CanonicalForm | content (const CanonicalForm &f) |
| CanonicalForm content ( const CanonicalForm & f ) More...
|
|
CanonicalForm | content (const CanonicalForm &f, const Variable &x) |
| CanonicalForm content ( const CanonicalForm & f, const Variable & x ) More...
|
|
CanonicalForm | vcontent (const CanonicalForm &f, const Variable &x) |
| CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x ) More...
|
|
CanonicalForm | pp (const CanonicalForm &f) |
| CanonicalForm pp ( const CanonicalForm & f ) More...
|
|
CanonicalForm | gcd (const CanonicalForm &f, const CanonicalForm &g) |
|
CanonicalForm | lcm (const CanonicalForm &f, const CanonicalForm &g) |
| CanonicalForm lcm ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
gcd/content/lcm of polynomials
To compute the GCD different variants are chosen automatically
Definition in file cf_gcd.cc.
◆ cf_content()
◆ content() [1/2]
◆ content() [2/2]
◆ gcd()
Definition at line 262 of file cf_gcd.cc.
265 if (
b ||
g.isZero() )
272 if (
f.inPolyDomain() ||
g.inPolyDomain() )
274 if (
f.mvar() !=
g.mvar() )
276 if (
f.mvar() >
g.mvar() )
327 if (
f.inBaseDomain() &&
g.inBaseDomain() )
◆ gcd_poly()
CanonicalForm gcd_poly ( const CanonicalForm & f, const CanonicalForm & g )
gcd_poly() - calculate polynomial gcd.
This is the dispatcher for polynomial gcd calculation. Different gcd variants get called depending the input, characteristic, and on switches (cf_defs.h)
With the current settings from Singular (i.e. SW_USE_EZGCD= on, SW_USE_EZGCD_P= on, SW_USE_CHINREM_GCD= on, the EZ GCD variants are the default algorithms for multivariate polynomial GCD computations)
- See also
- gcd(), cf_defs.h
Definition at line 94 of file cf_gcd.cc.
97 bool fc_isUnivariate=
f.isUnivariate();
98 bool gc_isUnivariate=
g.isUnivariate();
99 bool fc_and_gc_Univariate=fc_isUnivariate && gc_isUnivariate;
123 else if (!fc_and_gc_Univariate)
◆ icontent() [1/2]
◆ icontent() [2/2]
◆ isPurePoly()
Definition at line 229 of file cf_factor.cc.
231 if (
f.level()<=0)
return false;
234 if (!(
i.coeff().inBaseDomain()))
return false;
◆ lcm()
CanonicalForm lcm ( const CanonicalForm & f, const CanonicalForm & g )
lcm() - return least common multiple of f and g.
The lcm is calculated using the formula lcm(f, g) = f * g / gcd(f, g).
Returns zero if one of f or g equals zero.
Definition at line 343 of file cf_gcd.cc.
345 if (
f.isZero() ||
g.isZero() )
348 return (
f /
gcd(
f,
g ) ) *
g;
◆ out_cf()
cf_algorithm.cc - simple mathematical algorithms.
Hierarchy: mathematical algorithms on canonical forms
Developers note:
A "mathematical" algorithm is an algorithm which calculates some mathematical function in contrast to a "structural" algorithm which gives structural information on polynomials.
Compare these functions to the functions in ‘cf_ops.cc’, which are structural algorithms.
Definition at line 90 of file cf_factor.cc.
93 if (
f.isZero()) printf(
"+0");
95 else if (!
f.inBaseDomain() )
101 if (
i.coeff().isOne())
104 if (e==0) printf(
"1");
108 if (e!=1) printf(
"^%d",e);
117 if (e!=1) printf(
"^%d",e);
142 printf(
"+%ld",
f.intval());
151 char * str =
new char[mpz_sizeinbase(
m, 10 ) + 2];
152 str = mpz_get_str( str, 10,
m );
161 char * str =
new char[mpz_sizeinbase(
m, 10 ) + 2];
162 str = mpz_get_str( str, 10,
m );
163 puts(str);putchar(
'/');
167 str =
new char[mpz_sizeinbase(
m, 10 ) + 2];
168 str = mpz_get_str( str, 10,
m );
183 if (
f.inExtension()) printf(
"E(%d)",
f.level());
◆ pp()
◆ vcontent()
CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x )
vcontent() - return content of f with repect to variables >= x.
The content is recursively calculated over all coefficients in f having level less than x. x should be a polynomial variable.
Definition at line 230 of file cf_gcd.cc.
232 ASSERT(
x.
level() > 0,
"cannot calculate vcontent with respect to algebraic variable" );
239 for (
i =
f;
i.hasTerms() && ! d.
isOne();
i++ )
static const int SW_RATIONAL
set to 1 for computations over Q
CanonicalForm lcm(const CanonicalForm &f, const CanonicalForm &g)
CanonicalForm lcm ( const CanonicalForm & f, const CanonicalForm & g )
class to iterate through CanonicalForm's
const CanonicalForm int const CFList const Variable & y
CanonicalForm subResGCD_0(const CanonicalForm &f, const CanonicalForm &g)
subresultant GCD over Z.
static CanonicalForm icontent(const CanonicalForm &f, const CanonicalForm &c)
static CanonicalForm icontent ( const CanonicalForm & f, const CanonicalForm & c )
CanonicalForm vcontent(const CanonicalForm &f, const Variable &x)
CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x )
static CanonicalForm ezgcd(const CanonicalForm &FF, const CanonicalForm &GG, REvaluation &b, bool internal)
real implementation of EZGCD over Z
CanonicalForm QGCD(const CanonicalForm &F, const CanonicalForm &G)
gcd over Q(a)
CanonicalForm gcd_poly(const CanonicalForm &f, const CanonicalForm &g)
CanonicalForm gcd_poly ( const CanonicalForm & f, const CanonicalForm & g )
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
#define GaloisFieldDomain
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
#define ASSERT(expression, message)
Rational abs(const Rational &a)
CanonicalForm modGCDFq(const CanonicalForm &F, const CanonicalForm &G, CanonicalForm &coF, CanonicalForm &coG, Variable &alpha, CFList &l, bool &topLevel)
GCD of F and G over , l and topLevel are only used internally, output is monic based on Alg....
CanonicalForm EZGCD_P(const CanonicalForm &FF, const CanonicalForm &GG)
Extended Zassenhaus GCD for finite fields. In case things become too dense we switch to a modular alg...
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
static const int SW_USE_FF_MOD_GCD
set to 1 to use modular GCD over F_q
CanonicalForm content(const CanonicalForm &f)
CanonicalForm content ( const CanonicalForm & f )
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
CanonicalForm subResGCD_p(const CanonicalForm &f, const CanonicalForm &g)
subresultant GCD over finite fields. In case things become too dense we switch to a modular algorithm
CanonicalForm modGCDFp(const CanonicalForm &F, const CanonicalForm &G, CanonicalForm &coF, CanonicalForm &coG, bool &topLevel, CFList &l)
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
static long imm2int(const InternalCF *const imm)
factory's class for variables
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
CanonicalForm gcd(const CanonicalForm &f, const CanonicalForm &g)
static CanonicalForm cf_content(const CanonicalForm &f, const CanonicalForm &g)
static CanonicalForm cf_content ( const CanonicalForm & f, const CanonicalForm & g )
void gmp_denominator(const CanonicalForm &f, mpz_ptr result)
void gmp_numerator(const CanonicalForm &f, mpz_ptr result)
static const int SW_USE_QGCD
set to 1 to use Encarnacion GCD over Q(a)
CanonicalForm modGCDZ(const CanonicalForm &FF, const CanonicalForm &GG)
modular GCD over Z
bool getReduce(const Variable &alpha)
CanonicalForm modGCDGF(const CanonicalForm &F, const CanonicalForm &G, CanonicalForm &coF, CanonicalForm &coG, CFList &l, bool &topLevel)
GCD of F and G over GF, based on Alg. 7.2. as described in "Algorithms for Computer Algebra" by Gedde...