Accurate and Fast Evaluation of Elementary Symmetric Functions Stef - - PowerPoint PPT Presentation

accurate and fast evaluation of elementary symmetric
SMART_READER_LITE
LIVE PREVIEW

Accurate and Fast Evaluation of Elementary Symmetric Functions Stef - - PowerPoint PPT Presentation

Accurate and Fast Evaluation of Elementary Symmetric Functions Stef Graillat LIP6/PEQUAN - Universit Pierre et Marie Curie (Paris 6) - CNRS Joint work with Hao Jiang and Roberto Barrio 21st IEEE International Symposium on Computer Arithmetic


slide-1
SLIDE 1

Accurate and Fast Evaluation of Elementary Symmetric Functions

Stef Graillat

LIP6/PEQUAN - Université Pierre et Marie Curie (Paris 6) - CNRS

Joint work with Hao Jiang and Roberto Barrio

21st IEEE International Symposium on Computer Arithmetic Austin, Texas, USA, April 7-10, 2013

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 1 / 28

slide-2
SLIDE 2

Motivations (1/2)

Polynomials play a central role in computational and applied mathematics The determination of the zeros of polynomials is a classical problem of computational mathematics Inverse problem : given the zeros, determine the coefficients of the polynomial

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 2 / 28

slide-3
SLIDE 3

Motivations (2/2)

Characteristic polynomial of a n×n matrix A det(λI −A) = λn +c1λn−1 +···+cn−1λ+cn c1 = trace(A) cn = det(A) Eigenvalues: (λi) for i = 1,...,n c1 =

n

  • i=1

λi cn =

n

  • i=1

λi → the ci are elementary symmetric functions of the λi

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 3 / 28

slide-4
SLIDE 4

Outline of the talk

Motivations Classical Summation Algorithm Error-free transformations Compensated Summation Algorithm Conclusion and future work

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 4 / 28

slide-5
SLIDE 5

Elementary Symmetric Functions (ESF)

Definition 1

The k-th Elementary Symmetric Function (ESF) associated with a vector of n numbers X = (x1,...,xn) is defined by S(n)

k (X) =

  • 1≤π1<...<πk≤n

xπ1xπ2 ...xπk with 1 ≤ k ≤ n For k = 0, S(n) = 1 The k-th function S(n)

k (X) consists of

n

k

  • summands

→ straightforward computation is very expensive

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 5 / 28

slide-6
SLIDE 6

Applications of computing ESF

The ESFs appear when expanding a linear factorization of a polynomial

n

  • i=1

(x−xi) =

n

  • i=0

cixi =

n

  • i=0

(−1)n−iS(n)

n−i(x1,...,xn)xi

One can evaluate polynomial’s coefficients {ci}n

i=0 from its zeros

{xi}n

i=1, specially compute characteristic polynomials from

eigenvalues Part of conditional maximum likelihood estimation (CMLE) of item parameters under the Rasch model in psychological

  • measurement. Accurate evaluation allows much more items to

be calibrated Thermodynamic properties of systems of fermions

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 6 / 28

slide-7
SLIDE 7

Condition number of ESF

Condition numbers measure the sensitivity of the solution of a problem to perturbation in the data

Definition 2 (Condition number of the k-th ESF)

cond(S(n)

k (X)) = lim ε→0sup

|S(n)

k (X +△X)−S(n) k (X)|

ε|S(n)

k (X)|

: |△X| < ε|X|

  • A direct calculation yields

cond(S(n)

k (X)) =

kS(n)

k (|X|)

|S(n)

k (X)|

In particular, cond(S(n)

n (X)) = cond(n i=1 xi) = n and

cond(S(n)

1 (X)) = cond(n i=1 xi) = n

i=1 |xi|

|n

i=1 xi|.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 7 / 28

slide-8
SLIDE 8

Classic Summation Algorithm

Algorithm 1

Input: X = (x1,...,xn) and k Output: k-th ESF S(n)

k (X) = S(n) k

function S(n)

k =SumESF(X,k)

S(i)

0 = 1, 1 ≤ i ≤ n−1;

S(i)

j = 0, j > i;

S(1)

1 = x1;

for i = 2 : n for j = max{1,i+k −n} : min{i,k}

S(i)

j = S(i−1) j

+xiS(i−1)

j−1 ;

end end

S(i)

j = S(i) j (x1,...,xi) = 1≤π1<...<πj≤i xπ1xπ2 ...xπj

Substitution of j = 1 : i for j = max{1,i+k −n} : min{i,k} makes it possible to compute all ESF simultaneously → Algorithm used in MATLAB poly function

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 8 / 28

slide-9
SLIDE 9

Standard model of floating-point arithmetic

Assume floating point arithmetic adhering IEEE 754 with rounding to nearest with rounding unit u (no underflow nor overflow) Let x,y ∈ F and ◦ ∈ {+,−,·,/}. The result x◦y is not in general a floating-point number fl(x◦y) = (x◦y)(1+δ), |δ| ≤ u IEEE 754 standard (2008)

Type Size Mantissa Exponent Unit rounding Interval binary32 32 bits 23+1 bits 8 bits u = 21−24 ≈ 1,92×10−7 ≈ 10±38 binary64 64 bits 52+1 bits 11 bits u = 21−53 ≈ 2,22×10−16 ≈ 10±308

We denote γn := nu 1−nu

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 9 / 28

slide-10
SLIDE 10

Rounding error analysis

Theorem 1 (Rehman, Ipsen (2011))

If X = (x1,...,xn) is a vector of floating-point numbers, the computed k-th elementary symmetric function S(n)

k

= S(n)

k (X) by Algorithm 1 in

floating-point arithmetic verifies

  • S(n)

k −S(n) k

S(n)

k

  • ≤ 1

kγ2(n−1)cond(S(n)

k ), 2 ≤ k ≤ n−1,

  • S(n)

1 −S(n) 1

S(n)

1

  • ≤ γn−1cond(S(n)

1 ) = γn−1

n

i=1 |xi|

|n

i=1 xi|, k = 1,

  • S(n)

n −S(n) n

S(n)

n

  • ≤ 1

nγn−1cond(S(n)

n ) = γn−1, k = n.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 10 / 28

slide-11
SLIDE 11

Getting more accuracy with compensated algorithms

Error-free transformations are properties and algorithms to compute the generated elementary rounding errors, a,b entries ∈ F, a◦b = fl(a◦b)+e, with e ∈ F Key tools for accurate computation fixed length expansions libraries: double-double (Briggs, Bailey, Hida, Li), quad-double (Bailey, Hida, Li) arbitrary length expansions libraries: Priest, Shewchuk compensated algorithms (Kahan, Priest, Ogita-Rump-Oishi, Graillat-Langlois-Louvet, etc.)

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 11 / 28

slide-12
SLIDE 12

EFT for the summation

x = fl(a±b) ⇒ a±b = x+y with y ∈ F, Algorithms of Dekker (1971) and Knuth (1974)

Algorithm 2 (EFT of the sum of 2 floating point numbers with |a| ≥ |b|)

function [x,y] = FastTwoSum(a,b) x = a⊕b y = (a⊖x)⊕b

Algorithm 3 (EFT of the sum of 2 floating point numbers)

function [x,y] = TwoSum(a,b) x = a⊕b z = x⊖a y = (a⊖(x⊖z))⊕(b⊖z)

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 12 / 28

slide-13
SLIDE 13

EFT for the product (1/3)

x = fl(a·b) ⇒ a·b = x+y with y ∈ F, Algorithm TwoProduct by Veltkamp and Dekker (1971) a = x+y and x and y non overlapping with |y| ≤ |x|.

Algorithm 4 (Error-free split of a floating point number into two parts)

function [x,y] = Split(a) factor = 2s +1 % u = 2−p , s = ⌈p/2⌉ c = factor⊗a x = c ⊖(c ⊖a) y = a⊖x

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 13 / 28

slide-14
SLIDE 14

EFT for the product (2/3)

Algorithm 5 (EFT of the product of 2 floating point numbers)

function [x,y] = TwoProduct(a,b) x = a⊗b [a1,a2] = Split(a) [b1,b2] = Split(b) y = a2 ⊗b2 ⊖(((x⊖a1 ⊗b1)⊖a2 ⊗b1)⊖a1 ⊗b2)

Theorem 2

Let a,b ∈ F and let x,y ∈ F such that [x,y] = TwoProduct(a,b) . Then, a·b = x+y, x = fl(a·b), |y| ≤ u|x|, |y| ≤ u|a·b|, The algorithm TwoProduct requires 17 flops.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 14 / 28

slide-15
SLIDE 15

EFT for the product (3/3)

Given a,b,c ∈ F,

FMA(a,b,c) is the nearest floating point number a·b+c ∈ F

Algorithm 6 (EFT of the product of 2 floating point numbers)

function [x,y] = TwoProductFMA(a,b) x = a⊗b y = FMA(a,b,−x) The FMA is available for example on PowerPC, Itanium, Cell, Xeon Phi processors.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 15 / 28

slide-16
SLIDE 16

Compensated Summation Algorithm

Algorithm 7

Input: X = (x1,...,xn) and k Output: k-th ESF S

(n) k (X) = S (n) k

function S

(n) k =CompSumESF(X,k)

  • S(i)

0 = 1, 1 ≤ i ≤ n−1;

S(i)

j = 0, j > i;

S(1)

1 = x1;

ǫS

(i) j = 0,∀ i,j

for i = 2 : n for j = max{1,i+k −n} : min{i,k}

[p,β(i)

j ] = TwoProd(xi,

S(i−1)

j−1 );

% S(i)

j = S(i−1) j

+xiS(i−1)

j−1

[ S(i)

j ,σ(i) j ] = TwoSum(

S(i−1)

j

,p);

  • ǫS

(i) j =

ǫS

(i−1) j

⊕(β(i)

j ⊕σ(i) j )⊕xi ⊗

ǫS

(i−1) j−1

end end

S

(n) k

= S(n)

k ⊕

ǫS

(n) k

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 16 / 28

slide-17
SLIDE 17

Error bound on the Compensated Summation Algorithm

Theorem 3

For a vector of n floating-point numbers X = (x1,...,xn), the relative forward error bound in Algorithm satisfies

  • S

(n) k −S(n) k

S(n)

k

  • ≤ u+ 1

kγ2

2(n−1)cond(S(n) k (X)),

  • S(n)

1 −S(n) 1

S(n)

1

  • ≤ u+γ2

n−1cond(S(n) 1 ),

  • S(n)

n −S(n) n

S(n)

n

  • ≤ u+ 1

nγnγ2ncond(S(n)

n ),

with 2 ≤ k ≤ n−1, k = 1, k = n, respectively.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 17 / 28

slide-18
SLIDE 18

Validated Running Error bound on the Compensated Summation Algorithm (1/2)

Algorithm 8

Input: X = (x1,...,xn) and k Output: k-th ESF S

(n) k (X) = S (n) k

and Running Error Bound µ

function [S

(n) k ,µ]=CompSumESFwErr(X,k)

  • S(i)

0 = 1, 1 ≤ i ≤ n−1;

  • S(i)

j = 0, j > i;

  • S(1)

1 = x1;

  • ǫS

(i) j = 0,

ES

(i) j = 0,∀ i,j

for i = 2 : n for j = max{1,i+k −n} : min{i,k}

[p,β(i)

j ] = TwoProd(xi,

S(i−1)

j−1 );

[ S(i)

j ,σ(i) j ] = TwoSum(

S(i−1)

j

,p);

  • ǫS

(i) j =

ǫS

(i−1) j

⊕(β(i)

j ⊕σ(i) j )⊕xi ⊗

ǫS

(i−1) j−1

  • ES

(i) j =

ES

(i−1) j

⊕|β(i)

j ⊕σ(i) j |⊕|xi|⊗

ES

(i−1) j−1

end end

[S

(n) k ,c] = FastTwoSum(

S(n)

k ,

ǫS

(n) k )

ˆ α = ( γ2(n−1) ⊗ ES

(n) k )⊘(1−3nu);

µ = (|c|⊕ ˆ α)⊘(1−2u)

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 18 / 28

slide-19
SLIDE 19

Validated Running Error bound on the Compensated Summation Algorithm (2/2)

Theorem 4

Assume 3nu < 1, then a running error bound of Algorithm 8 is given by |S

(n) k −S(n) k | ≤ fl

|c|⊕ α 1−2u

  • := µ,

where α is the “error bound” on the rounding errors and c is obtained by [S

(n) k ,c] = FastTwoSum(

S(n)

k ,

ǫS

(n) k ).

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 19 / 28

slide-20
SLIDE 20

Library double-double

A double-double number a is the pair (ah,al) of IEEE-754 floating-point numbers with a = ah +al and |al| ≤ u|ah|.

Algorithm 9 (Product of a d-d (ah,al) by a d b)

function [ch,cl] = prod_dd_d(ah,al,b) [sh,sl] = TwoProduct(ah,b) [th,tl] = FastTwoSum(sh,(al ⊗b)) [ch,cl] = FastTwoSum(th,(tl ⊕sl))

Algorithm 10 (Addition of a d b and a d-d (ah,al))

function [ch,cl] = add_dd_d(ah,al,b) [th,tl] = TwoSum(ah,b) [ch,cl] = FastTwoSum(th,(tl ⊕al))

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 20 / 28

slide-21
SLIDE 21

Accurate Summation Algorithm with

double-double

Algorithm 11

Input: X = (x1,...,xn) and k Output: k-th ESF S(n)

k (X) = S(n) k

= Sh(n)

k

function [Sh(n)

k ,Sl(n) k ]=DDSumESF(X,k)

Sh(i)

0 = 1, 1 ≤ i ≤ n−1;

Sh(i)

j = 0, j > i;

Sh(1)

1 = x1;

Sl(i)

j = 0,∀ i,j

for i = 2 : n for j = max{1,i+k −n} : min{i,k}

[rh,rl] = prod_dd_d(Sh(i−1)

j−1 ,Sl(i−1) j−1 ,xi);

[Sh(i)

j ,Sl(i) j ] = add_dd_dd(rh,rl,Sh(i−1) j

,Sl(i−1)

j

)

end end

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 21 / 28

slide-22
SLIDE 22

Accuracy with double-double (1/2)

For a standard model of floating-point arithmetic for the double-double algorithms fl(a⊙b) = (a⊙b)(1+δ), where a,b are in double-double format, ⊙∈{+,−,×,/}, and δ is bounded as follows |δ| ≤ udd for ⊙∈{+,−}; |δ| ≤ 2udd for ⊙∈{×,/} where udd = 2u2 = 2−105 is the roundoff unit in double-double format.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 22 / 28

slide-23
SLIDE 23

Accuracy with double-double (2/2)

Theorem 5

The values Sh

(n) k

and Sl

(n) k

returned by Algorithm 11 in floating-point arithmetic satisfy | Sh

(n) k −S(n) k |

|S(n)

k |

≤ u+ 1 k(1+u)γ3(n−1)cond(S(n)

k (X)),

where γ3(n−1) = 3(n−1)udd 1−3(n−1)udd = 6(n−1)u2 1−6(n−1)u2 .

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 23 / 28

slide-24
SLIDE 24

Numerical experiments (1/2)

10

5

10

10

10

15

10

20

10

25

10

30

10

−18

10

−16

10

−14

10

−12

10

−10

10

−8

10

−6

10

−4

10

−2

10

Condition Number Relative Forward Error

γ2(n−1)cond/k u+γ2(n−1)

2

cond/k SumESF CompSumESF DDSumESF LejaSumESF RunErrBound TheoBoundDD 1/u2 1/u

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 24 / 28

slide-25
SLIDE 25

Numerical experiments (2/2)

Time ratios of computing for k-th ESF (case 1) and for all ESF (case 2)

CompSumESF SumESF DDSumESF SumESF CompSumESF DDSumESF CompSumESF CompSumESFwErr

Case 1 3.05 5.42 57.42% 69.91% Case 2 3.91 7.48 52.97% 68.02%

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 25 / 28

slide-26
SLIDE 26

Conclusion and future work

Conclusion A fast algorithm to computed the Symmetric Elementary Functions as accurate as if computed with twice the working precision Future work An algorithm making it possible to deal with complex numbers An algorithm to compute a faithfully rounded result and then a correctly rounded result

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 26 / 28

slide-27
SLIDE 27

References

Daniela Calvetti and Lothar Reichel. On the evaluation of polynomial coefficients.

  • Numer. Algorithms, 33(1-4):153–161, 2003.

Takeshi Ogita, Siegfried M. Rump, and Shin’ichi Oishi. Accurate sum and dot product. SIAM J. Sci. Comput., 26(6):1955–1988, 2005. Rizwana Rehman and Ilse C. F . Ipsen. Computing characteristic polynomials from eigenvalues. SIAM J. Matrix Anal. Appl., 32(1):90–114, 2011.

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 27 / 28

slide-28
SLIDE 28

Thank you for your attention

  • S. Graillat (Univ. Paris 6)

Accurate and Fast Evaluation of ESF 28 / 28