What is the most space efficient way to store arbitrary length univariate polynomials? I have a large amount of polynomials that look like
3*x^7 + 12*x - 13 9*x^32 - x^14 + 2*x^3 - 9 ...
Each polynomial is composed of an arbitrary number of integer coefficients for a given power, e.g. the following polynomials could be stored as
(3,7) (12,1) (-13,0) (9,32) (1,14) (2,3) (-9, 0)
which is in fact exactly what I do now. I have a SQLite schema that looks something like
CREATE TABLE poly_lookup ( poly_id INTEGER PRIMARY KEY AUTOINCREMENT ); CREATE TABLE poly ( poly_id INTEGER, coeff INTEGER, power INTEGER ); CREATE INDEX idx_poly ON poly(poly_id);
This works, but I'm not sure this is the most space efficient solution. caveat responsum, I only know SQLite, but I would be willing to learn a completely new type of database system (mongodb, neo4j, ...) if it would help the solution.