My Project
|
Header for factory's main class CanonicalForm. More...
#include <iostream>
#include <stdint.h>
#include "cf_defs.h"
#include "variable.h"
#include "factory/cf_gmp.h"
#include "factory/templates/ftmpl_list.h"
#include "factory/templates/ftmpl_array.h"
#include "factory/templates/ftmpl_afactor.h"
#include "factory/templates/ftmpl_factor.h"
#include "factory/templates/ftmpl_matrix.h"
#include "si_log2.h"
#include "omalloc/omallocClass.h"
#include "cf_inline.cc"
Go to the source code of this file.
Data Structures | |
class | CanonicalForm |
factory's main class More... | |
Macros | |
#define | OSTREAM std::ostream |
#define | ISTREAM std::istream |
#define | CF_INLINE |
#define | CF_NO_INLINE |
#define | CF_INLINE inline |
Typedefs | |
typedef AFactor< CanonicalForm > | CFAFactor |
typedef List< CFAFactor > | CFAFList |
typedef ListIterator< CFAFactor > | CFAFListIterator |
typedef Factor< CanonicalForm > | CFFactor |
typedef List< CFFactor > | CFFList |
typedef ListIterator< CFFactor > | CFFListIterator |
typedef List< CanonicalForm > | CFList |
typedef ListIterator< CanonicalForm > | CFListIterator |
typedef Array< CanonicalForm > | CFArray |
typedef Matrix< CanonicalForm > | CFMatrix |
typedef List< CFList > | ListCFList |
typedef ListIterator< CFList > | ListCFListIterator |
typedef List< int > | IntList |
typedef ListIterator< int > | IntListIterator |
typedef List< Variable > | Varlist |
typedef ListIterator< Variable > | VarlistIterator |
typedef Array< int > | Intarray |
Header for factory's main class CanonicalForm.
Definition in file canonicalform.h.
#define CF_INLINE |
Definition at line 54 of file canonicalform.h.
#define CF_INLINE inline |
Definition at line 54 of file canonicalform.h.
#define CF_NO_INLINE |
Definition at line 47 of file canonicalform.h.
#define ISTREAM std::istream |
Definition at line 17 of file canonicalform.h.
#define OSTREAM std::ostream |
Definition at line 16 of file canonicalform.h.
typedef AFactor<CanonicalForm> CFAFactor |
Definition at line 389 of file canonicalform.h.
Definition at line 390 of file canonicalform.h.
typedef ListIterator<CFAFactor> CFAFListIterator |
Definition at line 391 of file canonicalform.h.
typedef Array<CanonicalForm> CFArray |
Definition at line 397 of file canonicalform.h.
typedef Factor<CanonicalForm> CFFactor |
Definition at line 392 of file canonicalform.h.
Definition at line 393 of file canonicalform.h.
typedef ListIterator<CFFactor> CFFListIterator |
Definition at line 394 of file canonicalform.h.
typedef List<CanonicalForm> CFList |
Definition at line 395 of file canonicalform.h.
typedef ListIterator<CanonicalForm> CFListIterator |
Definition at line 396 of file canonicalform.h.
typedef Matrix<CanonicalForm> CFMatrix |
Definition at line 398 of file canonicalform.h.
Definition at line 405 of file canonicalform.h.
Definition at line 401 of file canonicalform.h.
typedef ListIterator<int> IntListIterator |
Definition at line 402 of file canonicalform.h.
typedef List<CFList> ListCFList |
Definition at line 399 of file canonicalform.h.
typedef ListIterator<CFList> ListCFListIterator |
Definition at line 400 of file canonicalform.h.
Definition at line 403 of file canonicalform.h.
typedef ListIterator<Variable> VarlistIterator |
Definition at line 404 of file canonicalform.h.
CanonicalForm apply | ( | const CanonicalForm & | f, |
void(*)(CanonicalForm &, int &) | mf | ||
) |
CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) )
apply() - apply mf to terms of f.
Calls mf( f[i], i ) for each term f[i]*x^i of f and builds a new term from the result. If f is in a coefficient domain, mf( f, i ) should result in an i == 0, since otherwise it is not clear which variable to use for the resulting term.
An example:
Then apply( f, diff ) is differentiation of f with respect to the main variable of f.
Definition at line 402 of file cf_ops.cc.
CanonicalForm FACTORY_PUBLIC blcm | ( | const CanonicalForm & | f, |
const CanonicalForm & | g | ||
) |
Definition at line 1816 of file canonicalform.cc.
CanonicalForm FACTORY_PUBLIC content | ( | const CanonicalForm & | f | ) |
CanonicalForm content ( const CanonicalForm & f )
content() - return content(f) with respect to main variable.
Normalizes result.
CanonicalForm FACTORY_PUBLIC content | ( | const CanonicalForm & | f, |
const Variable & | x | ||
) |
CanonicalForm content ( const CanonicalForm & f, const Variable & x )
content() - return content(f) with respect to x.
x should be a polynomial variable.
Definition at line 629 of file cf_gcd.cc.
|
inline |
Definition at line 316 of file canonicalform.h.
|
inline |
Definition at line 319 of file canonicalform.h.
int * degrees | ( | const CanonicalForm & | f, |
int * | degs | ||
) |
int * degrees ( const CanonicalForm & f, int * degs )
degress() - return the degrees of all polynomial variables in f.
Returns 0 if f is in a coefficient domain, the degrees of f in all its polynomial variables in an array of int otherwise:
degrees( f, 0 )[i] = degree( f, Variable(i) )
If degs is not the zero pointer the degrees are stored in this array. In this case degs should be larger than the level of f. If degs is the zero pointer, an array of sufficient size is allocated automatically.
Definition at line 493 of file cf_ops.cc.
|
inline |
Definition at line 340 of file canonicalform.h.
|
inline |
Definition at line 346 of file canonicalform.h.
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm div | ( | const CanonicalForm & | , |
const CanonicalForm & | |||
) |
CanonicalForm FACTORY_PUBLIC gcd | ( | const CanonicalForm & | f, |
const CanonicalForm & | g | ||
) |
Definition at line 685 of file cf_gcd.cc.
CanonicalForm FACTORY_PUBLIC gcd_poly | ( | const CanonicalForm & | f, |
const CanonicalForm & | g | ||
) |
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)
Definition at line 492 of file cf_gcd.cc.
int FACTORY_PUBLIC getCharacteristic | ( | ) |
Definition at line 70 of file cf_char.cc.
int getGFDegree | ( | ) |
Definition at line 75 of file cf_char.cc.
CanonicalForm getGFGenerator | ( | ) |
Definition at line 81 of file cf_char.cc.
int getNumVars | ( | const CanonicalForm & | f | ) |
int getNumVars ( const CanonicalForm & f )
getNumVars() - get number of polynomial variables in f.
Definition at line 314 of file cf_ops.cc.
CanonicalForm getVars | ( | const CanonicalForm & | f | ) |
CanonicalForm getVars ( const CanonicalForm & f )
getVars() - get polynomial variables of f.
Return the product of all of them, 1 if there are not any.
Definition at line 350 of file cf_ops.cc.
bool hasFirstAlgVar | ( | const CanonicalForm & | f, |
Variable & | a | ||
) |
check if poly f contains an algebraic variable a
Definition at line 679 of file cf_ops.cc.
|
inline |
Definition at line 360 of file canonicalform.h.
|
inline |
Definition at line 369 of file canonicalform.h.
CanonicalForm FACTORY_PUBLIC icontent | ( | const CanonicalForm & | f | ) |
CanonicalForm icontent ( const CanonicalForm & f )
icontent() - return gcd over all coefficients of f which are in a coefficient domain.
Definition at line 74 of file cf_gcd.cc.
|
inline |
Definition at line 352 of file canonicalform.h.
|
inline |
Definition at line 65 of file canonicalform.h.
bool FACTORY_PUBLIC isOn | ( | int | sw | ) |
|
inline |
Definition at line 304 of file canonicalform.h.
|
inline |
Definition at line 307 of file canonicalform.h.
|
inline |
Definition at line 310 of file canonicalform.h.
|
inline |
Definition at line 313 of file canonicalform.h.
CanonicalForm FACTORY_PUBLIC lcm | ( | const CanonicalForm & | f, |
const CanonicalForm & | g | ||
) |
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.
CanonicalForm leftShift | ( | const CanonicalForm & | F, |
int | n | ||
) |
left shift the main variable of F by n
Definition at line 697 of file cf_ops.cc.
|
inline |
Definition at line 331 of file canonicalform.h.
CanonicalForm mapdomain | ( | const CanonicalForm & | f, |
CanonicalForm(*)(const CanonicalForm &) | mf | ||
) |
CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )
mapdomain() - map all coefficients of f through mf.
Recursively descends down through f to the coefficients which are in a coefficient domain mapping each such coefficient through mf and returns the result.
Definition at line 440 of file cf_ops.cc.
|
inline |
Definition at line 355 of file canonicalform.h.
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod | ( | const CanonicalForm & | , |
const CanonicalForm & | |||
) |
|
inline |
Definition at line 334 of file canonicalform.h.
|
inline |
Definition at line 337 of file canonicalform.h.
void FACTORY_PUBLIC Off | ( | int | sw | ) |
void FACTORY_PUBLIC On | ( | int | sw | ) |
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator% | ( | const CanonicalForm & | , |
const CanonicalForm & | |||
) |
CF_INLINE CanonicalForm operator* | ( | const CanonicalForm & | lhs, |
const CanonicalForm & | rhs | ||
) |
Definition at line 524 of file cf_inline.cc.
CF_INLINE CanonicalForm operator+ | ( | const CanonicalForm & | lhs, |
const CanonicalForm & | rhs | ||
) |
CF_INLINE CanonicalForm operator +, -, *, /, % ( const CanonicalForm & lhs, const CanonicalForm & rhs )
operators +, -, *, /, %(), div(), mod() - binary arithmetic operators.
The binary operators have their standard (mathematical) semantics. As explained for the corresponding arithmetic assignment operators, the operators ‘/’ and ‘%’ return the quotient resp. remainder of (polynomial) division with remainder, whereas ‘div()’ and ‘mod()’ may be used for exact division and term-wise remaindering, resp.
It is faster to use the arithmetic assignment operators (e.g., ‘f += g;’) instead of the binary operators (‘f = f+g;’ ).
lhs, rhs: CurrentPP
There are weaker preconditions for some cases (e.g., arithmetic operations with elements from Q or Z work in any domain), but type ‘CurrentPP’ is the only one guaranteed to work for all cases.
All binary operators have their corresponding ‘CanonicalForm’ assignment operators (e.g., ‘operator +()’ corresponds to ‘CanonicalForm::operator +=()’, ‘div()’ corresponds to `CanonicalFormdiv()).
And that is how they are implemented, too: Each of the binary operators first creates a copy of ‘lhs’, adds ‘rhs’ to this copy using the assignment operator, and returns the result.
Definition at line 503 of file cf_inline.cc.
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator- | ( | const CanonicalForm & | , |
const CanonicalForm & | |||
) |
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator/ | ( | const CanonicalForm & | , |
const CanonicalForm & | |||
) |
CanonicalForm FACTORY_PUBLIC power | ( | const CanonicalForm & | f, |
int | n | ||
) |
exponentiation
Definition at line 1896 of file canonicalform.cc.
CanonicalForm FACTORY_PUBLIC power | ( | const Variable & | v, |
int | n | ||
) |
exponentiation
Definition at line 1939 of file canonicalform.cc.
CanonicalForm FACTORY_PUBLIC pp | ( | const CanonicalForm & | f | ) |
CanonicalForm pp ( const CanonicalForm & f )
pp() - return primitive part of f.
Returns zero if f equals zero, otherwise f / content(f).
CanonicalForm reduce | ( | const CanonicalForm & | f, |
const CanonicalForm & | M | ||
) |
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of f are reduced modulo M
Definition at line 660 of file cf_ops.cc.
CanonicalForm FACTORY_PUBLIC replacevar | ( | const CanonicalForm & | f, |
const Variable & | x1, | ||
const Variable & | x2 | ||
) |
CanonicalForm replacevar ( const CanonicalForm & f, const Variable & x1, const Variable & x2 )
replacevar() - replace all occurences of x1 in f by x2.
In contrast to swapvar(), x1 may be an algebraic variable, but x2 must be a polynomial variable.
Definition at line 271 of file cf_ops.cc.
void FACTORY_PUBLIC setCharacteristic | ( | int | c | ) |
Definition at line 28 of file cf_char.cc.
void setCharacteristic | ( | int | c, |
int | n | ||
) |
void setCharacteristic | ( | int | c, |
int | n, | ||
char | name | ||
) |
Definition at line 61 of file cf_char.cc.
|
inline |
Definition at line 343 of file canonicalform.h.
int size | ( | const CanonicalForm & | f | ) |
int size ( const CanonicalForm & f )
size() - return number of monomials in f which are in an coefficient domain.
Returns one if f is in an coefficient domain.
Definition at line 627 of file cf_ops.cc.
int size | ( | const CanonicalForm & | f, |
const Variable & | v | ||
) |
int size ( const CanonicalForm & f, const Variable & v )
size() - count number of monomials of f with level higher or equal than level of v.
Returns one if f is in an base domain.
Definition at line 600 of file cf_ops.cc.
int size_maxexp | ( | const CanonicalForm & | f, |
int & | maxexp | ||
) |
|
inline |
Definition at line 349 of file canonicalform.h.
CanonicalForm FACTORY_PUBLIC swapvar | ( | const CanonicalForm & | f, |
const Variable & | x1, | ||
const Variable & | x2 | ||
) |
swapvar() - swap variables x1 and x2 in f.
Returns the image of f under the map which maps x1 to x2 and x2 to x1. This is done quite efficiently because it is used really often. x1 and x2 should be polynomial variables.
Definition at line 168 of file cf_ops.cc.
|
inline |
Definition at line 325 of file canonicalform.h.
|
inline |
Definition at line 328 of file canonicalform.h.
|
inline |
Definition at line 322 of file canonicalform.h.
int totaldegree | ( | const CanonicalForm & | f | ) |
int totaldegree ( const CanonicalForm & f )
totaldegree() - return the total degree of f.
If f is zero, return -1. If f is in a coefficient domain, return 0. Otherwise return the total degree of f in all polynomial variables.
Definition at line 523 of file cf_ops.cc.
int totaldegree ( const CanonicalForm & f, const Variable & v1, const Variable & v2 )
totaldegree() - return the total degree of f as a polynomial in the polynomial variables between v1 and v2 (inclusively).
If f is zero, return -1. If f is in a coefficient domain, return 0. Also, return 0 if v1 > v2. Otherwise, take f to be a polynomial in the polynomial variables between v1 and v2 and return its total degree.
Definition at line 554 of file cf_ops.cc.
CanonicalForm FACTORY_PUBLIC vcontent | ( | const CanonicalForm & | f, |
const Variable & | x | ||
) |
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 653 of file cf_gcd.cc.