[BACK]Return to bracket_polynomials.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Schubert

Annotation of OpenXM_contrib/PHC/Ada/Schubert/bracket_polynomials.ads, Revision 1.1.1.1

1.1       maekawa     1: with Generic_Lists;
                      2: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
                      3: with Brackets,Bracket_Monomials;         use Brackets,Bracket_Monomials;
                      4:
                      5: package Bracket_Polynomials is
                      6:
                      7: -- DESCRIPTION :
                      8: --   This package offers a data representation of polynomials with
                      9: --   complex coefficients and brackets as unknowns.
                     10:
                     11:   type Bracket_Term is record
                     12:     coeff : Complex_Number;
                     13:     monom : Bracket_Monomial;
                     14:   end record;
                     15:
                     16:   type Bracket_Polynomial is private;
                     17:
                     18: -- CONSTRUCTORS :
                     19:
                     20:   function Create ( m : Bracket_Monomial ) return Bracket_Polynomial;
                     21:   function Create ( t : Bracket_Term ) return Bracket_Polynomial;
                     22:
                     23:   -- DESCRIPTION :
                     24:   --   Creates a bracket polynomial consisting out of one term.
                     25:   --   When only the monomial is given, the coefficient equals one.
                     26:
                     27:   procedure Copy ( t1 : in Bracket_Term; t2 : in out Bracket_Term );
                     28:
                     29:   -- DESCRIPTION :
                     30:   --   Copies the term t1 to the term t2.
                     31:
                     32:   procedure Copy ( p : in Bracket_Polynomial; q : in out Bracket_Polynomial );
                     33:
                     34:   -- DESCRIPTION :
                     35:   --   Copies the polynomial p to the polynomial q.
                     36:   --   Note that q := p leads to data sharing and side effects.
                     37:
                     38: -- COMPARISON OPERATIONS :
                     39:
                     40:   function Is_Equal ( t1,t2 : Bracket_Term ) return boolean;
                     41:   function Is_Equal ( p,q : Bracket_Polynomial ) return boolean;
                     42:
                     43:   -- DESCRIPTION :
                     44:   --   Returns true if both bracket terms/polynomials are the same.
                     45:
                     46:   function ">" ( t1,t2 : Bracket_Term ) return boolean;
                     47:   function "<" ( t1,t2 : Bracket_Term ) return boolean;
                     48:
                     49:   -- DESCRIPTION :
                     50:   --   The order on terms is induced by the order on bracket monomials.
                     51:
                     52: -- ARITHMETIC OPERATIONS :
                     53:
                     54:   function "+" ( t : Bracket_Term; p : Bracket_Polynomial )
                     55:                return Bracket_Polynomial;
                     56:   function "+" ( p : Bracket_Polynomial; t : Bracket_Term )
                     57:                return Bracket_Polynomial;
                     58:   procedure Add ( p : in out Bracket_Polynomial; t : in Bracket_Term );
                     59:
                     60:   -- DESCRIPTION :
                     61:   --   Adds a term t to the bracket polynomial p.
                     62:
                     63:   procedure Frontal_Add ( p : in out Bracket_Polynomial; t : in Bracket_Term );
                     64:
                     65:   -- DESCRIPTION :
                     66:   --   Adds the term in front of p, without respect of order or whether
                     67:   --   a term with same degrees as t already exists.
                     68:
                     69:   function "+" ( p,q : Bracket_Polynomial ) return Bracket_Polynomial;
                     70:   procedure Add ( p : in out Bracket_Polynomial; q : in Bracket_Polynomial );
                     71:
                     72:   -- DESCRIPTION : returns p+q or makes p := p+q.
                     73:
                     74:   function "-" ( t : Bracket_Term ) return Bracket_Term;
                     75:   function "-" ( p : Bracket_Polynomial ) return Bracket_Polynomial;
                     76:
                     77:   procedure Min ( t : in out Bracket_Term );
                     78:   procedure Min ( p : in out Bracket_Polynomial );
                     79:
                     80:   -- DESCRIPTION :
                     81:   --   Returns -t, -p or changes t, p into -t, -p.
                     82:
                     83:   function "-" ( t : Bracket_Term; p : Bracket_Polynomial )
                     84:                return Bracket_Polynomial;
                     85:   function "-" ( p : Bracket_Polynomial; t : Bracket_Term )
                     86:                return Bracket_Polynomial;
                     87:   procedure Min ( p : in out Bracket_Polynomial; t : in Bracket_Term );
                     88:
                     89:   -- DESCRIPTION :
                     90:   --   Subtracts a term t to the bracket polynomial p.
                     91:
                     92:   procedure Frontal_Min ( p : in out Bracket_Polynomial; t : in Bracket_Term );
                     93:
                     94:   -- DESCRIPTION :
                     95:   --   Adds the term -t in front of p, without respect of order or whether
                     96:   --   a term with same degrees as t already exists.
                     97:
                     98:   function "-" ( p,q : Bracket_Polynomial ) return Bracket_Polynomial;
                     99:   procedure Min ( p : in out Bracket_Polynomial; q : in Bracket_Polynomial );
                    100:
                    101:   -- DESCRIPTION : returns p-q or makes p := p-q.
                    102:
                    103: -- ITERATORS OVER MONOMIALS :
                    104:
                    105:   function Number_of_Monomials ( p : Bracket_Polynomial ) return natural;
                    106:
                    107:   -- DESCRIPTION :
                    108:   --   Returns the number of monomials in p.
                    109:
                    110:   generic
                    111:     with procedure Process ( t : in Bracket_Term; continue : out boolean );
                    112:   procedure Enumerate_Terms ( p : in Bracket_Polynomial );
                    113:
                    114:   -- DESCRIPTION :
                    115:   --   Visits all terms, ordered lexicographically, and applies the
                    116:   --   procedure Process to each of them.  Enumeration stops when
                    117:   --   continue is set to false.
                    118:
                    119: -- DESTRUCTOR :
                    120:
                    121:   procedure Clear ( t : in out Bracket_Term );
                    122:   procedure Clear ( p : in out Bracket_Polynomial );
                    123:
                    124:   -- DESCRIPTION :
                    125:   --   Deallocates the occupied memory.
                    126:
                    127: private
                    128:
                    129:   package Lists_of_Bracket_Terms is new Generic_Lists(Bracket_Term);
                    130:   type Bracket_Polynomial is new Lists_of_Bracket_Terms.List;
                    131:
                    132: end Bracket_Polynomials;

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