FORM 4.3
|
#include "poly.h"
#include "polygcd.h"
#include "polyfact.h"
#include <iostream>
#include <vector>
#include <map>
#include <climits>
#include <cassert>
Go to the source code of this file.
Functions | |
WORD | poly_determine_modulus (PHEAD bool multi_error, bool is_fun_arg, string message) |
WORD * | poly_gcd (PHEAD WORD *a, WORD *b, WORD fit) |
WORD * | poly_divmod (PHEAD WORD *a, WORD *b, int divmod, WORD fit) |
WORD * | poly_div (PHEAD WORD *a, WORD *b, WORD fit) |
WORD * | poly_rem (PHEAD WORD *a, WORD *b, WORD fit) |
void | poly_ratfun_read (WORD *a, poly &num, poly &den) |
void | poly_sort (PHEAD WORD *a) |
WORD * | poly_ratfun_add (PHEAD WORD *t1, WORD *t2) |
int | poly_ratfun_normalize (PHEAD WORD *term) |
void | poly_fix_minus_signs (factorized_poly &a) |
WORD * | poly_factorize (PHEAD WORD *argin, WORD *argout, bool with_arghead, bool is_fun_arg) |
int | poly_factorize_argument (PHEAD WORD *argin, WORD *argout) |
WORD * | poly_factorize_dollar (PHEAD WORD *argin) |
int | poly_factorize_expression (EXPRESSIONS expr) |
int | poly_unfactorize_expression (EXPRESSIONS expr) |
WORD * | poly_inverse (PHEAD WORD *arga, WORD *argb) |
WORD * | poly_mul (PHEAD WORD *a, WORD *b) |
void | poly_free_poly_vars (PHEAD const char *text) |
Variables | |
const int | POLYWRAP_DENOMPOWER_INCREASE_FACTOR = 2 |
Contains methods to call the polynomial methods (written in C++) from the rest of Form (written in C). These include polynomial gcd computation, factorization and polyratfuns.
Definition in file polywrap.cc.
WORD poly_determine_modulus | ( | PHEAD bool | multi_error, |
bool | is_fun_arg, | ||
string | message | ||
) |
Modulus for polynomial algebra
This method determines whether polynomial algebra is done with a modulus or not. This depends on AC.ncmod. If only_funargs is set it also depends on (AC.modmode & ALSOFUNARGS).
The program terminates if the feature is not implemented. Polynomial algebra modulo M > WORDSIZE in not implemented. If multi_error is set, multivariate algebra mod M is not implemented.
Definition at line 79 of file polywrap.cc.
Referenced by poly_factorize(), poly_factorize_expression(), poly_gcd(), poly_ratfun_add(), and poly_ratfun_normalize().
WORD * poly_gcd | ( | PHEAD WORD * | a, |
WORD * | b, | ||
WORD | fit | ||
) |
Polynomial gcd
This method calculates the greatest common divisor of two polynomials, given by two zero-terminated Form-style term lists.
Definition at line 124 of file polywrap.cc.
References poly_determine_modulus().
WORD * poly_divmod | ( | PHEAD WORD * | a, |
WORD * | b, | ||
int | divmod, | ||
WORD | fit | ||
) |
Definition at line 194 of file polywrap.cc.
WORD * poly_div | ( | PHEAD WORD * | a, |
WORD * | b, | ||
WORD | fit | ||
) |
Definition at line 424 of file polywrap.cc.
WORD * poly_rem | ( | PHEAD WORD * | a, |
WORD * | b, | ||
WORD | fit | ||
) |
Definition at line 445 of file polywrap.cc.
Read a PolyRatFun
This method reads a polyratfun starting at the pointer a. The resulting numerator and denominator are written in num and den. If MUSTCLEANPRF, the result is normalized.
Definition at line 471 of file polywrap.cc.
Referenced by poly_ratfun_add(), and poly_ratfun_normalize().
void poly_sort | ( | PHEAD WORD * | a | ) |
Sort the polynomial terms
Sorts the terms of a polynomial in Form poly(rat)fun order, i.e. lexicographical order with highest degree first.
Definition at line 557 of file polywrap.cc.
References Compare1(), CompareSymbols(), EndSort(), LowerSortLevel(), NewSort(), StoreTerm(), and SymbolNormalize().
Referenced by poly_ratfun_add(), and poly_ratfun_normalize().
WORD * poly_ratfun_add | ( | PHEAD WORD * | t1, |
WORD * | t2 | ||
) |
Addition of PolyRatFuns
This method gets two pointers to polyratfuns with up to two arguments each and calculates the sum.
Definition at line 600 of file polywrap.cc.
References poly_determine_modulus(), poly_ratfun_read(), and poly_sort().
Referenced by AddPoly(), and MergePatches().
int poly_ratfun_normalize | ( | PHEAD WORD * | term | ) |
Multiplication/normalization of PolyRatFuns
This method seaches a term for multiple polyratfuns and multiplies their contents. The result is properly normalized. Normalization also works for terms with a single polyratfun.
Definition at line 719 of file polywrap.cc.
References poly_determine_modulus(), poly_ratfun_read(), and poly_sort().
Referenced by PolyFunMul(), and PrepPoly().
void poly_fix_minus_signs | ( | factorized_poly & | a | ) |
Definition at line 857 of file polywrap.cc.
WORD * poly_factorize | ( | PHEAD WORD * | argin, |
WORD * | argout, | ||
bool | with_arghead, | ||
bool | is_fun_arg | ||
) |
Factorization of function arguments / dollars
This method factorizes a Form style argument or zero-terminated term list.
Definition at line 922 of file polywrap.cc.
References poly_determine_modulus().
Referenced by poly_factorize_argument(), and poly_factorize_dollar().
int poly_factorize_argument | ( | PHEAD WORD * | argin, |
WORD * | argout | ||
) |
Factorization of function arguments
This method factorizes the Form-style argument argin.
Definition at line 1047 of file polywrap.cc.
References poly_factorize().
WORD * poly_factorize_dollar | ( | PHEAD WORD * | argin | ) |
Factorization of dollar variables
This method factorizes a dollar variable.
Definition at line 1074 of file polywrap.cc.
References poly_factorize().
int poly_factorize_expression | ( | EXPRESSIONS | expr | ) |
Factorization of expressions
This method factorizes an expression.
Definition at line 1100 of file polywrap.cc.
References EndSort(), Generator(), FiLe::handle, LocalConvertToPoly(), LowerSortLevel(), NewSort(), and poly_determine_modulus().
Referenced by PF_Processor(), and Processor().
int poly_unfactorize_expression | ( | EXPRESSIONS | expr | ) |
Unfactorization of expressions
This method expands a factorized expression.
Definition at line 1457 of file polywrap.cc.
References EndSort(), Generator(), FiLe::handle, LowerSortLevel(), and NewSort().
Referenced by PF_Processor(), and Processor().
WORD * poly_inverse | ( | PHEAD WORD * | arga, |
WORD * | argb | ||
) |
Definition at line 1665 of file polywrap.cc.
WORD * poly_mul | ( | PHEAD WORD * | a, |
WORD * | b | ||
) |
Definition at line 1794 of file polywrap.cc.
void poly_free_poly_vars | ( | PHEAD const char * | text | ) |
Definition at line 1853 of file polywrap.cc.
const int POLYWRAP_DENOMPOWER_INCREASE_FACTOR = 2 |
Definition at line 52 of file polywrap.cc.