Multivariate data structures

1.Coordinates and monomials

Dense and sparse representations of polynomials assume that internal operations are applied on polynomials having the same number of variables. For computing comfortably with any finite number of variables that can be different for different polynomials, the multimix library proposes wrappers to monomials and polynomials, that store an additional set of coordinates. The general wrapper multivariate<R>, defined in multivariate.hpp, basically contains an element of type R and a related set of coordinates.

A coordinate, of type multivariate_coordinate, is essentially seen as a unique symbol made of a generic. A set of coordinates is of type multivariate_coordinates, as defined in multivariate_coordinates.hpp, which also contains related set operations.

#include <multimix/monomial.hpp>
#include <multimix/multivariate.hpp>

// construction of coordinates from literals
multivariate_coordinate<> x (lit ("x")), y (lit ("y")), z (lit ("z"));
multivariate_coordinates<> coords_xy (vec (x, y));
multivariate_coordinates<> coords_xz (vec (x, z));

// definition of the monomial x * y^2
multivariate<monomial<> > m1 (coords_xy, vec<nat> (1, 2) );
// definition of the monomial x^3 * z^2
multivariate<monomial<> > m2 (coords_xz, vec<nat> (3, 2));
mmout << m1 * m2 << lf;

In the above example the product m1 * m2 represents the monomial , whose set of coordinates is .

Multivariate structures are glued to mmx-light, and can be used as follows:

Mmx]  
use "multimix"; type_mode? := true;
Mmx]  
x: Coordinate == coordinate ('x)

:

Mmx]  
y: Coordinate == coordinate ('y)

:

Mmx]  
coords_xy: Coordinates == coordinates (x, y)

:

Mmx]  
m == monomial (x) * monomial (y)

:

Mmx]  
m.coordinates

:

2.Polynomials

Wrapped multivariate polynomials are glue to mmx-light, and can be used naturally as in the following example, continued from the previous session:

Mmx]  
X: MVPolynomial Integer == mvpolynomial (1 :> Integer, monomial (x))

:

Mmx]  
Y: MVPolynomial Integer == mvpolynomial (1 :> Integer, monomial (y))

:

Mmx]  
p == (X + Y)^10

:

Mmx]  
p.coordinates

:

Here sparse_polynomial is used internally. Wrapped dag polynomials can also be used as follows:

Mmx]  
a: Polynomial_dag Integer ==
  polynomial_dag (1:> Integer, monomial (coordinate ('a)))

:

Mmx]  
b: Polynomial_dag Integer ==
  polynomial_dag (1:> Integer, monomial (coordinate ('b)))

:

Mmx]  
(a + b)^3 - 1

:

3.Sparse interpolation

Sparse interpolation features are glued to mmx-light and can be used as follows on a dag polynomial (continued from the previous session):

Mmx]  
f: Polynomial_dag Integer == det ([a, b; b, a])

:

Mmx]  
as_mvpolynomial% f

:

Sparse interpolation is also available on functions as follows:

Mmx]  
h (v: Vector Integer, p: Integer): Integer == {
   m: Modulus Integer == modulus p;
   return preimage big_add ([ (z mod m)^10 / (10 mod m) | z in v ]); }

:

Mmx]  
h ([1, 2], 101)

:

Mmx]  
as_mvpolynomial% (h, coords_xy, 10000)

:

Verbosity and profiling of sparse interpolation can be set via the global variables sparse_interpolation_debug? and sparse_interpolation_profile?.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License. If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.