FORM 4.3
Functions | Variables
polywrap.cc File Reference
#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
 

Detailed Description

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.

Function Documentation

◆ poly_determine_modulus()

WORD poly_determine_modulus ( PHEAD bool multi_error,
bool is_fun_arg,
string message )

Modulus for polynomial algebra

Description

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.

Notes

  • If AC.ncmod>0 and only_funargs=true and AC.modmode&ALSOFUNARGS=false, AN.ncmod is set to zero, for otherwise RaisPow calculates mod M.

Definition at line 79 of file polywrap.cc.

Referenced by poly_factorize(), poly_factorize_expression(), poly_gcd(), poly_ratfun_add(), and poly_ratfun_normalize().

◆ poly_gcd()

WORD * poly_gcd ( PHEAD WORD * a,
WORD * b,
WORD fit )

Polynomial gcd

Description

This method calculates the greatest common divisor of two polynomials, given by two zero-terminated Form-style term lists.

Notes

  • The result is written at newly allocated memory
  • Called from ratio.c
  • Calls polygcd::gcd

Definition at line 124 of file polywrap.cc.

References poly_determine_modulus().

◆ poly_divmod()

WORD * poly_divmod ( PHEAD WORD * a,
WORD * b,
int divmod,
WORD fit )

Definition at line 194 of file polywrap.cc.

◆ poly_div()

WORD * poly_div ( PHEAD WORD * a,
WORD * b,
WORD fit )

Definition at line 424 of file polywrap.cc.

◆ poly_rem()

WORD * poly_rem ( PHEAD WORD * a,
WORD * b,
WORD fit )

Definition at line 445 of file polywrap.cc.

◆ poly_ratfun_read()

void poly_ratfun_read ( WORD * a,
poly & num,
poly & den )

Read a PolyRatFun

Description

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.

Notes

  • Calls polygcd::gcd

Definition at line 471 of file polywrap.cc.

Referenced by poly_ratfun_add(), and poly_ratfun_normalize().

◆ poly_sort()

void poly_sort ( PHEAD WORD * a)

Sort the polynomial terms

Description

Sorts the terms of a polynomial in Form poly(rat)fun order, i.e. lexicographical order with highest degree first.

Notes

  • Uses Form sort routines with custom compare

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().

◆ poly_ratfun_add()

WORD * poly_ratfun_add ( PHEAD WORD * t1,
WORD * t2 )

Addition of PolyRatFuns

Description

This method gets two pointers to polyratfuns with up to two arguments each and calculates the sum.

Notes

  • The result is written at the workpointer
  • Called from sort.c and threads.c
  • Calls poly::operators and polygcd::gcd

Definition at line 600 of file polywrap.cc.

References poly_determine_modulus(), poly_ratfun_read(), and poly_sort().

Referenced by AddPoly(), and MergePatches().

◆ poly_ratfun_normalize()

int poly_ratfun_normalize ( PHEAD WORD * term)

Multiplication/normalization of PolyRatFuns

Description

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.

Notes

  • The result overwrites the original term
  • Called from proces.c
  • Calls poly::operators and polygcd::gcd

Definition at line 719 of file polywrap.cc.

References poly_determine_modulus(), poly_ratfun_read(), and poly_sort().

Referenced by PolyFunMul(), and PrepPoly().

◆ poly_fix_minus_signs()

void poly_fix_minus_signs ( factorized_poly & a)

Definition at line 857 of file polywrap.cc.

◆ poly_factorize()

WORD * poly_factorize ( PHEAD WORD * argin,
WORD * argout,
bool with_arghead,
bool is_fun_arg )

Factorization of function arguments / dollars

Description

This method factorizes a Form style argument or zero-terminated term list.

Notes

  • Called from poly_factorize_{argument,dollar}
  • Calls polyfact::factorize

Definition at line 922 of file polywrap.cc.

References poly_determine_modulus().

Referenced by poly_factorize_argument(), and poly_factorize_dollar().

◆ poly_factorize_argument()

int poly_factorize_argument ( PHEAD WORD * argin,
WORD * argout )

Factorization of function arguments

Description

This method factorizes the Form-style argument argin.

Notes

  • The result is written at argout
  • Called from argument.c
  • Calls poly_factorize

Definition at line 1047 of file polywrap.cc.

References poly_factorize().

◆ poly_factorize_dollar()

WORD * poly_factorize_dollar ( PHEAD WORD * argin)

Factorization of dollar variables

Description

This method factorizes a dollar variable.

Notes

  • The result is written at newly allocated memory.
  • Called from dollar.c
  • Calls poly_factorize

Definition at line 1074 of file polywrap.cc.

References poly_factorize().

◆ poly_factorize_expression()

int poly_factorize_expression ( EXPRESSIONS expr)

Factorization of expressions

Description

This method factorizes an expression.

Notes

  • The result overwrites the input expression
  • Called from proces.c
  • Calls polyfact::factorize

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().

◆ poly_unfactorize_expression()

int poly_unfactorize_expression ( EXPRESSIONS expr)

Unfactorization of expressions

Description

This method expands a factorized expression.

Notes

  • The result overwrites the input expression
  • Called from proces.c

Definition at line 1457 of file polywrap.cc.

References EndSort(), Generator(), FiLe::handle, LowerSortLevel(), and NewSort().

Referenced by PF_Processor(), and Processor().

◆ poly_inverse()

WORD * poly_inverse ( PHEAD WORD * arga,
WORD * argb )

Definition at line 1665 of file polywrap.cc.

◆ poly_mul()

WORD * poly_mul ( PHEAD WORD * a,
WORD * b )

Definition at line 1794 of file polywrap.cc.

◆ poly_free_poly_vars()

void poly_free_poly_vars ( PHEAD const char * text)

Definition at line 1853 of file polywrap.cc.

Variable Documentation

◆ POLYWRAP_DENOMPOWER_INCREASE_FACTOR

const int POLYWRAP_DENOMPOWER_INCREASE_FACTOR = 2

Definition at line 52 of file polywrap.cc.