[BACK]Return to generic_laur_poly_functions.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials

Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Polynomials/generic_laur_poly_functions.ads, Revision 1.1.1.1

1.1       maekawa     1: with Abstract_Ring;
                      2: with Abstract_Ring.Field;
                      3: with Generic_Vectors;
                      4: with Generic_Laurent_Polynomials;
                      5:
                      6: generic
                      7:
                      8:   with package Ring is new Abstract_Ring(<>);
                      9:   with package Field is new Ring.Field(<>);
                     10:   with package Vectors is new Generic_Vectors(Ring);
                     11:   with package Polynomials is new Generic_Laurent_Polynomials(Ring);
                     12:
                     13: package Generic_Laur_Poly_Functions is
                     14:
                     15: -- DESCRIPTION :
                     16: --   Besides the term by term evaluation, two special data structures are
                     17: --   provided for efficient evaluation of polynomials in several variables.
                     18: --   With negative exponents, numeric/constraint errors are raised when
                     19: --   zero is evaluated.
                     20:
                     21:   use Ring,Field,Vectors,Polynomials;
                     22:
                     23: -- FUNCTION TYPE :
                     24:
                     25:   type Evaluator is access function ( x : Vector ) return number;
                     26:
                     27: -- DATA STRUCTURES :
                     28:
                     29:   type Eval_Poly is private;
                     30:   type Eval_Coeff_Poly is private;
                     31:
                     32: -- CONSTRUCTORS :
                     33:
                     34:   function Create ( p : Poly ) return Eval_Poly;
                     35:   function Create ( p : Poly ) return Eval_Coeff_Poly;
                     36:
                     37:   procedure Diff ( p : in Poly; i : in integer;
                     38:                    cp : out Eval_Coeff_Poly; m : out Vector );
                     39:     -- evaluable coefficient polynomial of the partial derivative,
                     40:     -- with m the multiplication factors of the coefficients of p
                     41:
                     42:   function Coeff ( p : Poly ) return Vector;  -- returns coefficient vector
                     43:
                     44: -- EVALUATORS :
                     45:
                     46:   function Eval ( p : Poly; x : number; i : integer ) return Poly;
                     47:      -- return p(x1,..,xi=x,..,xn);
                     48:      -- Number_of_Unknowns(Eval(p,x,i)) = Number_of_Unknowns(p)-1
                     49:
                     50:   function Eval ( d : Degrees; c : number; x : Vector ) return number;
                     51:                                                             -- return c*x**d
                     52:   function Eval ( t : Term; c : number; x : Vector ) return number;
                     53:                                              -- return c*x**d, with d = t.dg
                     54:   function Eval ( t : Term; x : Vector ) return number;
                     55:
                     56:   function Eval ( p : Poly; x : Vector ) return number;       -- return p(x)
                     57:   function Eval ( p : Poly; c,x : Vector ) return number;
                     58:                      -- return p(c,x), with c = vector of coefficients for p
                     59:
                     60:   function Eval ( p : Eval_Poly; x : Vector ) return number;  -- return p(x)
                     61:   function Eval ( p : Eval_Coeff_Poly; c,x : Vector ) return number;
                     62:      -- return p(c,x), with c = vector of coefficients for p
                     63:
                     64: -- DESTRUCTORS : deallocate memory.
                     65:
                     66:   procedure Clear ( p : in out Eval_Poly );
                     67:   procedure Clear ( p : in out Eval_Coeff_Poly );
                     68:
                     69: private
                     70:
                     71:   type Eval_Poly_Rep;
                     72:   type Eval_Coeff_Poly_Rep;
                     73:
                     74:   type Eval_Poly is access Eval_Poly_Rep;
                     75:   type Eval_Coeff_Poly is access Eval_Coeff_Poly_Rep;
                     76:
                     77: end Generic_Laur_Poly_Functions;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>