• 沒有找到結果。

NCTS 2006 School on Modern Numerical Methods in Mathematics and Physics : The Use of a Preconditioner in Iterative Methods for Solving Large-scale Eigenvalue Problems

N/A
N/A
Protected

Academic year: 2021

Share "NCTS 2006 School on Modern Numerical Methods in Mathematics and Physics : The Use of a Preconditioner in Iterative Methods for Solving Large-scale Eigenvalue Problems"

Copied!
52
0
0

加載中.... (立即查看全文)

全文

(1)

The Use of a Preconditioner in

Iterative Methods for Solving

Large-scale Eigenvalue

Problems

Chao Yang

Computational Research Division

Lawerence Berkeley National Laboratory Berkeley, California, USA

(2)

Limitation of a Krylov Subspace

May require a high degree polynomial

φ(λ)

to produce an accurate approximation

z = φ(A)v

0;

Subspace of large dimension Many restarts

Spectral transformation may be

prohibitively costly (sometime impossible)

(3)

Preconditioner for

Ax = b

Solve

K

−1

Ax = K

−1

b

; Choose

K

such that

κ(K

−1

A) ≪ κ(A)

;

Eigenvalue of

κ(K

−1

A) ≪ κ(A)

are clustered;

K

is easy to construct, and solving

Ky = z

is more efficient than solving

(4)

Preconditioner for

Ax = λx

?

Eigenvectors are not preserved under

K

−1

A

;

Cannot extract correct spectral info from

K(K

−1

A, b; m)

directly;

However, preconditioning does make

sense if we treat an eigenvalue problem as

a system of nonlinear equations (JD) an optimization problem (LOBPCG)

(5)

Nonlinear Equation Point of View

Because

λ(x) = x

T

Ax/x

T

x

,

Ax = λ(x)x,

is a nonlinear equation in

x

; Alternative formulation

Ax = (x

T

Ax)x

x

T

x = 1

Many solutions;

(6)

Solve by Newton’s Correction

Given a starting guess

u

such that

u

T

u = 1

;

Let

θ = u

T

Au

;

Seek

(z, δ)

pair such that

A(u + z) = (θ + δ)(u + z)

Ignore the 2nd order term

δz

(Newton correction) and impose

(7)

The Correction Equation

Augmented form

 A − θI u

u

T

0

 

z

−δ



=

 −r

0



,

where

r = Au − θu

; Projected form

(I − uu

T

)(A − θI)(I − uu

T

)z = −r

where

u

T

z = 0

(8)

Solving the Correction Eq (Direct)

Assume θ not converged yet, block elimination yields

  I 0 uT (A − θI)−1 1     A − θI u 0 γ     z −δ   =   −r 0   , where γ = uT (A − θ)−1u δ = u T (A − θI)−1r uT(A − θI)−1u.

(9)

Connection with Inverse Iteration

Adding correction

z

to

u

directly

x = u + z = u + δ(A − θI)−1u − u = δ(A − θI)−1u

Quadratic convergence in general Cubic convergence for symmetric problems

But requires solving

(A − θI)x = u

(10)

Jacobi-Davidson (JD)

Solving the correction equation iteratively

(I − uu

T

)(A − θI)(I − uu

T

)z = −r

where

u

T

z = 0

Allows the use of a preconditioner; Instead of adding

z

to

u

, construct a

search space

S = {u, z}

;

(11)

JD Inner-outer Iteration

Input: A, v0, tol;

Output: (u, θ) such that kAu − θuk is small

1. u ← v0/kv0k, V ← (u), θ = uT Au, r ← Au − θu;

2. while ( krk > tol)

(a) Iteratively solve the correction equation

(I − V V T)(A − θI)(I − V V T)z = −r approximately; (b) z ← (I − V V T )z;

(c) V ← (V, z), H = V T AV ;

(d) Solve Hy = θy and select the desired (y, θ);

(12)

Practical Issues

Choose an iterative solver and a preconditioner (for the correction equation);

Set tolerance for the inner iteration; Shift selection;

Restart (set a limit on the dimension of

V

); Compute more than one eigenpair

(13)

Preconditioner for the Correction Eq

If

K ≈ A

, then

K ≈ ˆ

ˆ

A

, where

ˆ

K = (I − V V T )K(I − V V T), A = (I − V Vˆ T)A(I − V V T);

Precondition: must solve

Kx = b

ˆ

;

Use augmented formulation and block elimination ˆ K† = (I − Y G−1V T )K−1 = K−1(I − V G−1UT ), where Y = K−1V , G = V TY , U = K−TY ; MATVEC: y ← (I − V G−1Y T)K−1A(I − Y G−1V T)x

(14)

Termination Criterion - Inner Iteration

Fixed tolerance (larger than that required for the eigen-residual)

Dynamic tolerance (tighter when eigen-residual small)

Can estimate eigen-residual from the correction equation residual for certain solvers (CG, sQMR)

(15)

Example

normal mode vibration analysis for macromolecules

3000-atom,

n = 9000

, interested in low frequency modes (small eigenvalues)

(16)

Effect of Preconditioner

0 20 40 60 80 100 120 140 160 180 200 10−5 10−4 10−3 10−2 10−1 100 101 102 103 i λi λ(F) λ(B−1F) 0 20 40 60 80 100 120 140 160 180 200 10−5 10−4 10−3 10−2 10−1 100 101 102 103 i λi λ(F) λ(L−1CL−T)

(17)

Convergence History

0 20 40 60 80 100 120 140 10−8 10−7 10−6 10−5 10−4 10−3 10−2 10−1

Convergence history of leading 20 eigenpairs of problem pe3k

work (flops) / n2

residual norm

(18)

Other Issues

Block version (not trivial)

Can extend JD to polynomial or rational

eigenvalue problems (Van der Vorst, Voss, Lin)

Automatic parameter tuning Missing eigenvalues?

(19)

The Optimization View

Only valid for symmetric problems, extreme eigenvalues Constrained optimization

min

xTx=1

x

T

Ax

Lagrangian

L(x, λ) = x

T

Ax − λ(x

T

x − 1)

KKT condition

Ax − λx = 0

x

T

x = 1

(20)

Geometry

−1.5 −1 −0.5 0 0.5 1 1.5 −1.5 −1 −0.5 0 0.5 1 1.5 constraint Rayleigh quotient

(21)

Direct Constrained Minimization

Assume

x

k is current approximation; Update by

x

k+1

= αx

k

+ βp

k

p

k is a descent (search) direction;

α

,

β

are chosen so that

x

Tk+1

x

k+1

= 1

;

(22)

Search Direction

Steepest descent

r

k

= −∇

x

L(x

k

, θ

k

) = −(Ax

k

− θ

k

x

k

)

Conjugate gradient

p

k

= p

k−1

+ γr

k Choose

γ

so that

p

Tk

Ap

k−1

= 0

Maintaining the orthonormality constraint?

(23)

Subspace Minimization

Let

V = (x

k

, p

k−1

, r

k

)

, then

x

k+1

= V y

k, for some

y

k

∈ R

3; Must solve

min

yT k V T V yk=1

y

kT

V

T

AV y

k Equivalent to solving

Gy

k

= λBy

k

y

kT

By

k

= 1

where

B = V

T

V

and

G = V

T

AV

;

(24)

Compute More Eigenpairs

Trace minimization

min

XT X=I m

1

2

trace

(X

T

AX)

where

X ∈ R

n×m; Gradient

R

k

= ∇

X

L(X

k

, Λ

k

) = AX

k

− X

k

Λ

k

,

where

Λ

k

= X

kT

AX

k;

(25)

LOBPCG (Knyazev)

Input: A, K, X0 ∈ Rn×m, tol;

Output: (X, Λ) such that kAX − XΛk is small

1. Orthonormalize columns of X0, Λ = X0∗AX0, i = 1,

P0 = [ ],R1 = AX0 − X0Λ,;

2. while ( kRik > tol)

(a) Set V = (Xi−1, Pi−1, K−1Ri);

(b) Compute the eigenvectors G corresponding to the m

smallest eigenvalues of (H, B), where B = V TV and

H = V TAV ;

(c) Xi = V G(1 : m, :); Λi = XiT AXi,

Pi = V G(m + 1 : 3m, :);

(26)

Practical Issues

Choice of preconditioner

Linear dependency between columns of

V

;

Deflation (not all eigenpairs converge at the same rate)

Extension to (symmetric) generalized eigenvalue problem (straightforward)

(27)

Example

Small accelerator model (n = 750)

Generalized problem

Interested in the smallest eigenvalue

0 100 200 300 400 500 600 700 0 100 200 300 400 500 600 700 nz = 26634

(28)

Change in residual

Diagonal Preconditioner 10−4 10−3 10−2 10−1 100 101 residual norm no preconditioner preconditioned

(29)

Extension to a Nonlinear EV Problem

Quantum many-body problem reduced to single-particle wavefunctions through

DFT;

single particle wavefunctions (orbitals)

X = (x1, x2, ..., xk), X∗X = Ik, xi ∈ Cn

n - real space grid size;

k - number of occupied states;

Charge density ρ(X) = diag(XX∗);

Kohn-Sham total energy

(30)

KS Total Energy Minimization

min

X∗X=Ik Etot(X) ≡ Ekinetic(X) + Eion(X) + EHartree(X) + Exc(X),

where Ekinetic = 1 2trace(X ∗LX) Eionic = 1 2 h trace(XDionX∗) + X i X ℓ (x∗wℓ)2 i EHartree = 1 4ρ(X) TSρ(X) Exc = eT (fxc[ρ(X)])

(31)

First order (KKT) Condition

KKT condition ∇XL(X, Λ) = 0; X∗X = I. Kohn-Sham equation H(X)X = XΛ, X∗X = I. Kohn-Sham Hamiltonian H(X) = L +Dion+ X ℓ wℓw∗+diag(Sρ(X)) +diaggxc(ρ(X))

(32)

Two Approaches

Work with the KS equation

Self-Consistent Field Iteration Minimize the total energy directly

Direct Constrained Minimization (extension of LOBPCG)

(33)

The SCF Iteration

    Initial X ? Solve H(X) ˆX = ˆX ˆΛ ?  PPPP PPP PP PP PPP  H( ˆX) ˆX = ˆX ˆΛ? ? Y N X ← ˆX - -Terminate

(34)

Problems with SCF

Does not always converge,

E

tot

(X)

may increase;

Little convergence theory

Fixed-point iteration

X

(i+)

= F (X

(i)

)

. But what is

F (·)

?

Solve large-scale linear eigenvalue at each iteration?

(35)

Direct Constrained Minimization

Minimize the total energy directly; Block method

Wavefunction update similar to LOBPCG

X(i+1) = X(i)Gx + P(i−1)Gp + R(i)Gr,

R(i) = K−1(H(X(i))X(i) − X(i)Θ(i)),

Θ(i) = X(i)∗H(X(i))X(i).

Choose Gx, Gp, Gr to

Minimize Etot in Y = (X(i), P(i−1), R(i));

(36)

Minimization within a Subspace

Let Y = (X(i), P(i−1), R(i)); Solve minGEtot(Y G) s.t.G∗Y ∗Y G = Ik Equivalent to solving ˆ H(G)G = BGΩk G∗BG = Ik, ˆ H(G) = Y ∗H(Y G)Y, B = Y ∗Y,

(37)

Solving the Projected Problem

A smaller nonlinear (generalized) eigenvalue problem

ˆ

H(G)G = BGΩ

k

G

BG = I

k

,

where

H(G) ∈ C

3k×3k,

G ∈ C

3k×k.

Modify SCF by introducting a trust region (TRSCF)

(38)

The Optimization View of SCF

SCF minimizes a sequence of surrogate models

Objective:

Etot(X) = Ekinetic(X) + Eion(X) + EHartree(X) + Exc(X)

Esurrogate(X) = 12trace(X∗H(X(i))X)

Gradient:

∇Etot(X) = H(X)X

(39)

Toy Example

E

tot

(x) =

1

2

x

T

Lx +

α

4

ρ(x)

T

L

−1

ρ(x)

L =



2 −1

−1 2



, x =

 x

1

x

2



, ρ(x) =

 x

2 1

x

22



min E

tot

(x)

s.t.

x

21

+ x

22

= 1

When does SCF work? How can it fail?

(40)

SCF Works (

α = 2.0

)

−1.5 −1 −0.5 0 0.5 1 1.5 x 2 constraint surrogate total energy

(41)

SCF Works

−0.85 −0.8 −0.75 −0.7 −0.65 −0.6 −0.75 −0.7 −0.65 −0.6 x 1 x 2 constraint surrogate total energy

(42)

SCF Fails (

α = 12.0

)

−1 −0.5 0 0.5 1 1.5 x 2 constraint surrogate total energy

(43)

SCF Fails

−0.9 −0.8 −0.7 −0.6 −0.5 −0.4 −0.3 −0.9 −0.8 −0.7 −0.6 −0.5 −0.4 x 1 x 2 constraint surrogate total energy

(44)

Improving SCF

Construct better surrogate

Cannot afford to use local quadratic approx (Hessian too expensive)

Charge-mixing

Use Trust Region to restrict the update of the wavefunction in a small neighborhood of the gradient matching point

TRSCF (Thogersen, Olsen, Yeager & Jorgensen 2004)

(45)

Trust Region

Must be defined on quantities that are “rotationally invariant” Density matrix

D(X) = D(XQ) = XX

∗; Charge density

ρ(X) = ρ(XQ) =

diag

(D(X))

; Use

kD(X) − D(X

(0)

)k

F

≤ ∆

The trust region subproblem must be easy to solve

(46)

Trust Region Subproblem

Instead of solving

min

XX=I

q(X)

s.t.kD(X) − D(X

(0)

)k

F

≤ ∆

We solve the penalized problem

min

X∗X−I

q(X) +

σ

2

kD(X) − D(X

(0)

k

2 F or equivalently

(47)

TRSCF

In each TRSCF iteration, we solve

min X∗X=I 1 2trace h X∗H(X(0)X − σX∗X(0)X(0)∗Xi

First order (KKT) condition

h H(X(0)) − σX(0)X(0)∗iX = XΛ X∗X = I At convergence λ1 − σ, λ2 − σ, ..., λk − σ, λk+1, ..., λn How to pick σ?

(48)

The Effect of Trust Region

−0.9 −0.8 −0.7 −0.6 −0.5 −0.4 x 2 constraint surrogate total energy

(49)

DCM

Input: L,Dion,wℓ, X0 ∈ Rn×m;

Output: X such that Etot(X) is minimized

1. Orthonormalize columns of X0, Θ = X0∗H(X(0))X0, i = 1,

P0 = [];

2. while ( not converged ) (a) Ri = H(Xi)Xi − XiΛ,

(b) Set Y = (Xi−1, Pi−1, L−1Ri);

(c) Solve minG∗Y ∗Y G=Ik Etot(Y G);

(d) Xi = Y G(1 : m, :); Λi = XiT AXi,

(50)

Numerical Example

Atomistic sytem: NiPtO

Discretization: spectral method with plane wave basis

n = 96 × 48 × 48 in real space, N = 15179 (number of basis functions) in frequency space

Number of occupied states k = 43

PETOT version of SCF does 10 PCG step per outer iteration

DCM 5 inner iteration

(51)

Convergence

0 100 200 300 400 500 10−7 10−6 10−5 10−4 10−3 10−2 10−1 100

wall clock time (seconds)

E(X

(i) )

DCM SCF

(52)

Conclusion

The use of a preconditioner is natural if we treat an eigenvalue problem (both linear and nonlinear) as

a nonlinear system of equations

a constrained nonlinear optimization

problem (for certain class of problems) The choice of preconditioner is application dependant

參考文獻

相關文件

For the assessment of Reading, Writing (Part 2: Correcting and Explaining Errors/Problems in a Student’s Composition) and Listening, which does not involve the use

Writing texts to convey simple information, ideas, personal experiences and opinions on familiar topics with some elaboration. Writing texts to convey information, ideas,

In this talk, we introduce a general iterative scheme for finding a common element of the set of solutions of variational inequality problem for an inverse-strongly monotone mapping

After teaching the use and importance of rhyme and rhythm in chants, an English teacher designs a choice board for students to create a new verse about transport based on the chant

In this paper, we have studied a neural network approach for solving general nonlinear convex programs with second-order cone constraints.. The proposed neural network is based on

Chen, The semismooth-related properties of a merit function and a descent method for the nonlinear complementarity problem, Journal of Global Optimization, vol.. Soares, A new

Arbenz et al.[1] proposed a hybrid preconditioner combining a hierarchical basis preconditioner and an algebraic multigrid preconditioner for the correc- tion equation in the

Qi (2001), Solving nonlinear complementarity problems with neural networks: a reformulation method approach, Journal of Computational and Applied Mathematics, vol. Pedrycz,