Storage of multivariate polynomials

Storage of multivariate polynomials
M. Gastineau
IMCCE - Observatoire de Paris - CNRS UMR8028
77, avenue Denfert Rochereau
75014 PARIS
FRANCE
[email protected]
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
A small example with general computer algebra system
How fast can we multiply 2 polynomials ?
p × (p + 1) with p = (1 + x + y + z + t)16
Execution on the same hardware and operating system
C.A.S.
GiNaC 1.3.2
Maple 10
Maxima 5.9.2
Pari/GP 2.3.0
Singular 3.0.2
time (s)
538.00
135.00
73.40
5.22
23.78
Differences of these C.A.S.
• algorithms
• storage and memory management
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
General Computer Algebra Systems
Store exponents as multiple precision integer
2128
P (x) = 1 + x
➪ Most computations need small integer exponents
< 28 or < 216 or < 232
➪ SAM uses hardware integers
Only one representation to handle all polynomials
• large generic objects
➪ SAM specializes the representation of the polynomials with their
attribute
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Contents
Storage
• Univariate polynomials
• Multivariate polynomials
!
P (x1 , x2 , ..., xn ) =
Cxd11 xd22 ...xdnn
• Poisson series
P (x1 , x2 , ..., xn , λ1 , ..., λm ) =
!
Cxd11 xd22 ...xdnn
"
#
cos
(k1 λ1 + ... + km λm )
sin
• Coefficients
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Univariate polynomials
K commutative ring
polynomials P (x) = a0 + a1 x + a2 x2 + ... + aD xD
such that D ∈ N
∀j, aj ∈ K
∀i > D, ai = 0
assume that P(x) has R non-zero terms
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Available representations for univariate polynomials
P (X) = 2 + 5X + 9X 4
Unordered structure : Hashmap
0
1
• Fast insertion O(1)
0
2
1
5
4
9
2
• Hashing function : key based on exponents
3
4
- how to choose this function ?
5
6
• Collision resolution
7
.
.
.
- chaining : linked-list
- open addressing : require to search an empty slot
• Resize the hash table on large polynomial ?
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Available representations for univariate polynomials
Sparse ordered structure
P (X) = 2 + 5X + 9X 4
• List of monomials
- search/insertion O(R)
X
0 2
1 5
4 9
- efficient for very sparse polynomial
Dense ordered structure
• vector
- minimal degree dmin (such that ∀i < dmin , ai = 0)
- maximal degree dmax (such that ∀i > dmax , ai = 0)
- all coefficients between dmin and dmax
- fast access O(1)
0
X
4
2 5 0 0 9
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Available representations for multivariate polynomials
Unordered structures
• Hashmap
Sparse ordered structure
• List of monomials
• Recursive list
• Direct Acyclic Graph
• Recursive vector
Distributed ordered structure
• Flat vector
• (Compacted) Homogeneous blocks
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Hash map
hash key = exponents
Collision resolution : chaining or cascading
0
0
0
0
3
0
1
1
9
2
0
2
8
4
0
0
9
0
0
1
5
0
1
0
11
0
0
3
7
1
1
1
13
1
2
3
4
5
6
7
8
9
Used by GIAC and MAGMA
Pros : insertion/search usually in O(1) but worst case in O(R)
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
General trees
A node = an operator +,*,^
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
ADD
3
MUL
5
Z
11
Y
❶ ❶ ❶
X Y Z 13
MUL
❷ ❷
X Z
POW
POW
❸
Z 7
❹
X 9
MUL
8
❶ ❶
Y Z 9
Used by GINAC
Pros : very easy to extend with your custom algebraic classes
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Directed Acyclic Graph
No duplicated leafs
couple of monomial and numeric coefficient
SUM
INTPOS
INTPOS
5
INTPOS
3
NAME
Y
NAME
Z
INTPOS
1
NAME
X
PROD
7
PROD
INTPOS 11
INTPOS
9
PROD
PROD
INTPOS 13
INTPOS
INTPOS
2
8
Used by MAPLE
PROD
INTPOS
4
Pros : handle any type of expressions
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Monomial sorted lists
Stores one monomial in an element of the sorted list
an element = vector of exponents + coefficient
Used by SINGULAR
Pros : efficient for small polynomials
access to the leading term
Cons : insertion/search in O(R)
0
0
0
3
0
0
1
5
0
0
3
7
0
1
0
11
0
1
1
9
1
1
1
13
2
0
2
8
4
0
0
9
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
recursive representations
polynomial in n variables could considered as polynomial in 1
variable with coefficients in the polynomial ring in n-1 variables
P (x1 , x2 , ..., xn ) ∈ K[x1 , x2 , ..., xn ]
P (xn ) ∈ K[x1 , x2 , ..., xn−1 ][xn ]
same data structure as the univariate polynomials
• handle very sparse polynomials.
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Recursive list
Tuple of coefficient and exponent
Contains only non zero coefficient
Used by TRIP
Pros : handle all polynomials
Cons : inefficient with large degree and few variables
e.g. P (x, y) = y + (1 + x)1000
X
0 3
1
0
1
1 5
3 7
Y
Z
0
Y
Z
2
4 9
1
Z
0 11
1 9
2 8
Z
1 13
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Recursive vector
Stores the minimal and maximal degree
Store all coefficients into vectors
!
Contains zero coefficients
"
! $
#
!
%
%
&
!
*
,
&
'
' ( ! )
!
*
+
*
%
%
%% $
*
%'
Used by TRIP
Pros : Fast access to a monomial
Cons : inefficient if polynomials
have many zeros
1000
e.g. P (x) = 1 + x
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Sparse structures and processors
Sparse structures ➪ less locality of data
Modern CPU ➪ multiple levels of cache
RAM
RAM
6Mo
Cache L3 6MB
Cache L2 256KB
256Ko
RAM
L3 12MB
RAM
L3 2MB
L3 12MB
L2 256KB L2 256KB
L2 512KB L2 512KB L2 512KB L2 512KB
Cache L1 16KB
Cache L1 32KB
32Ko
L1 64KB
L1 64KB
L1 64KB
L1 64KB
L1 64KB
L1 64KB
1 core
11coeur
core
processeur
CPU
1 core
1 core
1 core
1 core
1 core
1 core
CPU
1993
Pentium
2003
Itanium2
CPU
2006
Itanium2
montecito
CPU
2007
opteron
L1 : 2 cycles
L2 : 5 cycles
L3 : 12~21 cycles
main memory : ~200 cycles
Distributed structure : access data in order (prefetch) ➪ better locality
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Flat vector
variables
X1
Xn
exponents
1 2
coefficients
m
1st term
2nd term
65th term
66th term
64*(m-1)+1 term
64*(m-1)+2 term
64th term
128th term
64*m term
1 2
m
Store exponents and coefficients in separate vectors
polynomial has many terms ➪ split the vectors
Terms are sorted on exponents
Exponents are compressed with shift and mask operations :
negligible overhead (only integer arithmetics)
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Flat vector 2/2
Length of each vector is variable
➪ insertion is faster than using a single large vector
Pros : Use dichotomy to search a term
Cons : many insertions are very expensive (many copies)
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
!"#"$
0
0
0
0
0
1
2
4
0
0
0
1
1
1
0
0
0
1
3
0
1
1
2
0
3
5
7
11
9
13
8
9
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 1/4
BHδ (x1 , ...xN ) = set of monomial of degree δ in x1 , ..., xN
P (x1 , ..., xN ) = BH0 (x1 , ...xN ) + BH1 (x1 , ...xN ) + ... + BHD (x1 , ...xN )
0
0
0
0
0
1
1
1
1
2
2
2
3
3
4
0
1
2
3
4
0
1
2
3
0
1
2
0
1
0
4
3
2
1
0
3
2
1
0
2
1
0
1
0
0
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 2/4
Number of monomials in a block
δ=0
δ=1
δ=2
δ=3
δ=4
δ=5
δ=6
δ=7
δ=8
δ=9
δ=10
δ=11
δ=12
δ=13
δ=14
δ=15
δ=16
δ=17
δ=18
δ=19
δ=20
n=3
1
3
6
10
15
21
28
36
45
55
66
78
91
105
120
136
153
171
190
210
231
n=4
1
4
10
20
35
56
84
120
165
220
286
364
455
560
680
816
969
1140
1330
1540
1771
n=5
1
5
15
35
70
126
210
330
495
715
1001
1365
1820
2380
3060
3876
4845
5985
7315
8855
10626
n=6
1
6
21
56
126
252
462
792
1287
2002
3003
4368
6188
8568
11628
15504
20349
26334
33649
42504
53130
δ
Cδ+N
−1
n=7
1
7
28
84
210
462
924
1716
3003
5005
8008
12376
18564
27132
38760
54264
74613
100947
134596
177100
230230
(δ + N − 1)!
=
δ!(N − 1)!
n=8
1
8
36
120
330
792
1716
3432
6435
11440
19448
31824
50388
77520
116280
170544
245157
346104
480700
657800
888030
n=9
1
9
45
165
495
1287
3003
6435
12870
24310
43758
75582
125970
203490
319770
490314
735471
1081575
1562275
2220075
3108105
n=10
1
10
55
220
715
2002
5005
11440
24310
48620
92378
167960
293930
497420
817190
1307504
2042975
3124550
4686825
6906900
10015005
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Store only the coefficients in the vector
BH(X,Y,Z)
BH0
BH1
BH2
BH3
BH4
3
5
11
0
0
9
0
0
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
9
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Store only the coefficients in the vector
BH(X,Y,Z)
0
0
1
BH0
BH1
BH2
BH3
BH4
0 31
1 0
0 0
5
11
0
0
9
0
0
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
9
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Store only the coefficients in the vector
BH(X,Y,Z)
BH0
BH1
BH2
BH3
BH4
30
0 52
1 111
2 00
0 1
1 0
0 0
0
9
0
0
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
9
0
0
1
1
2
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Store only the coefficients in the vector
BH(X,Y,Z)
BH0
BH1
3
50
0
11
00
0
1
1
1
2
2
3
0
1
2
3
0
1
2
0
1
0
BH2
BH3
BH4
03
92
01
00
02
01
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
9
0
1
0
0
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Store only the coefficients in the vector
BH(X,Y,Z)
BH0
BH1
3
5
11
0
BH2
BH3
BH4
00
90
00
00
00
01
1
1
1
2
2
2
3
3
4
0 04
1 03
2 02
3 01
4 00
03
0 13
1 02
2 01
3 00
0 02
1 1
2 0
0 1
1 0
0 0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
9
P (x, y, z) = 3 + 5z + 7z 3 + 11y + 9yz + 13xyz + 8x2 z 2 + 9x4
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Function to compute index in a homogeneous block
Algorithm 1: Compute the index of a coefficient in a homogeneous block
of degree δ in n variables from the exponents
Input: expo : array of n exponents
Output: index : index of the coefficient in the array of coefficients
!n
δ ← i=1 expo[n]
index ← 1
d←δ
for i ← 1 to n − 1 do
!expo[n]−1 d−j
index ← index + j!0
Cd−j+i−1
d ← d − expo[i]
end
return index
Optimization if n fixed at compilation time
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Homogeneous blocks 3/4
Exponents :
• Shared exponent tables :
- All blocks in memory of same degree will reference the same
exponent table
- Used in TRIP
- Pros: Fast access to all exponents
- Cons: Require large amount of memory for high degree
• Always computed with an internal function
- Pros: memory footprint = 0 bytes !
- Cons: Require computations to have exponents from the location
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Mixing representation
sparse structures for some variables
distributed structures for other variables
V
W0
BH
0..4
0
1
2
1
(X,Y,Z)
W1
BH
2..6
(X,Y,Z)
49
W2
BH
8
0..1
(X,Y,Z)
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Compacted homogeneous blocks 1/2
For very sparse polynomials
• remove the zeros
• use an index vector to keep the location in the exponent table or
to retrieve exponents from a computational function.
• Insertion algorithm requires a duplication of the two vectors,
but multiple insertion could work on the non-compacted block.
• The search algorithm has the complexity of the size of the index
vector.
BHC(X,Y,Z)
BHC0 BHC1 BHC2 BHC3 BHC4
3
5 1
11 2
9 2
13 6
8 10
9 15
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
d’Alembert block
If combination of exponents has some properties
Based on homogeneous block
• use a modified function to compute the new location
• use a specific exponent table
- Used in TRIP for the d’Alembert properties
Example : d’Alembert rules
P (z, z, ζ, ζ, z
!
, z ! , ζ ! , ζ ! , λ, λ! )
=
!
!
!
!
!
ni ni nj nj ! ni ! ni ! nj ! nj
Cz z ζ ζ z z ζ ζ
i(kλ+k! λ! )
exp
• δ = ni + ni + nj + nj + n!i + n!i + n!j + n!j
• cI (T ) = k + k !
• cM (T ) = (ni + n!i + nj + n!j ) − (ni + n!i + nj + n!j ).
cI (T ) = CM (T ) and
cI (T ), CM (T ) and δ have the same parity.
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
d’Alembert block
Block with even parity in (y, y)
c, δ
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
1 2 3
− 8 −
2 − 20
6 −
10
4
52
−
40
−
19
5
−
100
−
70
−
28
6
200
−
178
−
112
−
44
7
−
350
−
280
−
168
−
60
8
617
−
560
−
424
−
240
−
85
i!
i!
9
−
980
−
840
−
600
−
330
−
110
j!
10
1568
−
1476
−
1200
−
830
−
440
−
146
11
−
2352
−
2100
−
1650
−
1100
−
572
−
182
12
3536
−
3360
−
2895
−
2200
−
1436
−
728
−
231
13
−
5040
−
4620
−
3850
−
2860
−
1820
−
910
−
280
14
7200
−
6940
−
6160
−
5014
−
3640
−
2282
−
1120
−
344
15
−
9900
−
9240
−
8008
−
6370
−
4550
−
2800
−
1360
−
408
j!
Table 1: Number of monomials (xi xi y j y j x! x! y ! y ! ) of degree δ and with
characteristic c.
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Poisson series
S(X1 , ...Xn , λ1 , .., λm ) =
!
cd,k X1d1 ...Xndn
d1 ,...,dn ,k1 ,...,km
"
cos
sin
#
(k1 λ1 + .... + km λm )
list of terms
Trigo. (co)sine
Poly.
coefficient
Trigo. (co)sine
Poly.
coefficient
...
circular linked-list of terms in EPSP, developed by Ivanova
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Poisson series
bidimensional structures
• access from polynomial and trigonometric part
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Poisson series
Complex form
S(X1 , ...Xn , λ1 , .., λm ) =
!
cd,k X1d1 ...Xndn expı(k1 λ1 +....+km λm )
d1 ,...,dn ,k1 ,...,km
• same representation as polynomials
• new variables Λm = expı(ωm λm +ϕm )
• k1 , ..., km
➪ integers
➪ literal values
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Benckmarks
Expansion of the perturbing function in the planetary problem
ρ2
ρ
V = α [ 2 − 1] + 2α[cos(λ − λ! ) − cos S]
α
α
2
expanded using the Poincaré’s variables
V (λ, λ , X, X, Y, Y , X
!
!
, X !, Y !, Y !)
=
3
Homogeneous block
Compacted homogeneous block
d'Alembert block
recursive vector
recursive list
flat vector
optimal representation
memory usage (Mbytes)
2.5
!
d1
d2
X X Y
d3
Y
d4
,X
!d5
d6
d8
X ! Y !d7 Y !
ı(k1 λ+k2 λ! )
exp
2
1.5
1
0.5
0
0
2000
4000
6000
8000
10000
12000
14000
16000
18000
20000
number of terms in V
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Benchmarks - sparsity
randomily selected terms from P (x1 , ...x10 ) = (1 + x1 + ... + x10 )10
2
homogeneous block
compacted homogeneous block
recursive vector
recursive list
flat vector
optimal representation
1.8
1.6
memory usage (Mbytes)
1.4
1.2
1
0.8
0.6
0.4
0.2
0
0
5000
10000
15000
20000
25000
30000
35000
40000
45000
number of terms
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Representations of coefficients
Numerical coefficients
• Fixed-size
- hardware floating-point numbers
- hardware or software integer and rational numbers
- floating-point interval
• multiple precision
- floating-point numbers
- integer and rational numbers
- floating-point interval
Literal coefficients
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
fixed-size floating-point numbers
representation of floating-point numbers in IEEE 754 standard
sign exponent
63 62
Format
Format width in bits
Significand in bits
Exponent width in bits
ulp(1)
2−52
significand
52 51
double
64
52+1
11
≈ 2, 22.10−16
double precision
0
extended
80
64+0
15
−63
2
≈ 1, 08.10−19
quadruple
128
112+1
15
−112
2
≈ 1, 92.10−34
double precision available on all platforms : hardware registers
extended precision available on intel or compatible processors 32 or 64 bits
quadruple precision is emulated with software on all platforms
- encoded with 2 doubles on PowerPC architectures (double-double)
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Time overhead
Compilation with Intel c++ 10.0.023
Execution on an Intel Xeon MP
Operation
+
×
/
cos
sqrt
textended
tdouble
1.6
1.9
2.0
2.0
4.5
tquadruple
tdouble
7.3
9.1
7.6
76.0
96.0
Execution on an Intel Itanium2
Operation
+
×
/
cos
sqrt
textended
tdouble
2
2
2
2
2
tquadruple
tdouble
17
20
38
90
140
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
fixed-size integer and rational numbers
use hardware registers (32 or 64 bits)
could use guard bits to detect the overflows on addition
rational numbers :
• structure of 2 integers
• use binary gcd to avoid division
• requires to redefine all basic operations
Used in SINGULAR for integers between 2^(-28) and 2^(+28)
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
integer and rational multiple precision
handle numbers with million bits !!!
require dynamic memory allocation ➪ automatic grow
• use FMA whenever possible ➪ avoid one temporary value
FMA(x,y,z) = x+y.z
available libraries
• GMP http://gmplib.org/ very portable and highly optimized
• NTL http://www.shoup.net/ntl slower than GMP
• CLN http://www.ginac.de/CLN/ less portable
Timings
Operation
+
×
/
tmpz t
tint64 t
11
6
12
tmpq t
tdouble
48
26
85
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
floating-point multiple precision
library MPFR
• extend the significant part of the IEEE754 real numbers
• FMA to reduce the intermediate values
library MPC
• based on MPFR
• implement the complex numbers
• provide correctly rounded arithmetic operations
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
floating-point interval
Interval
π ≈ 3.14159 replaced by π ⊂ [3.14158, 3.14160]
Interval arithmetic
• all operations must guarantee that the exact result is in the returned
interval
• interval could become very large [2, 3] − [2, 3] = [−1, 1]
Implementation using hardware floating-point
• use rounding-mode of the processor
• library FILIB++ and CostLy
Implementation using multiple precision floating-point
• library MPFI based on GMP/MPFR
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Benchmarks
P (x, y, z, t, u) = (1 + x + y + z + t + u)31
Type
double precision floating-point
quadruple precision floating-point
multiple precision floating-point (mpfr t) (significand = 53bits)
multiple precision floating-point (mpfr t) (significand = 200bits)
double precision floating-point interval
quadruple precision floating-point interval
multiple precision integer (mpz t)
Type
double precision floating-point
quadruple precision floating-point
multiple precision floating-point (mpfr t) (significand = 53bits)
multiple precision floating-point (mpfr t) (significand = 200bits)
double precision floating-point interval
quadruple precision floating-point interval
multiple precision integer (mpz t)
Size (bytes)
13739456
19771328
34851008
58978496
19771328
25803200
22915568
Execution time (s)
6.42
36.13
131.54
337.04
323.51
372.26
19.34
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
Benckmarks
P (x, y, z, t, u) = (1/2ı + 3/5x + y + (1 + 7/11ı)z + 13/17t + (31 + 21/29ı)u)31
Type
double precision floating-point
quadruple precision floating-point
multiple precision floating-point (mpc t) (significand = 53bits)
multiple precision floating-point (mpc t) (significand = 200bits)
double precision floating-point interval
quadruple precision floating-point interval
multiple precision integer (mpq t)
Type
double precision floating-point
quadruple precision floating-point
multiple precision floating-point (mpc t) (significand = 53bits)
multiple precision floating-point (mpc t) (significand = 200bits)
double precision floating-point interval
quadruple precision floating-point interval
multiple precision rational (mpq t)
Size (bytes)
13739456
25753152
55787392
103842176
25753152
37766848
61389176
Execution time (s)
24.33
156.74
611.20
1593.44
975.95
1244.21
4238.61
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS
literals
view as variables
• store a pointer to the name and the numerical coefficient
• only for recursive sparse representation
view as an opaque expression
Rational function and small divisor
P (λ1 , ....λn )
C(λ1 , ....λn ) =
with P and Q ∈ K[λ1 , ....λn ]
Q(λ1 , ....λn )
• encoding with an array of integers
• fraction-free representation
optimized expressions
Advanced School on Specific Algebraic Manipulators, 2007, © M. Gastineau, ASD/IMCCE/CNRS