Divide-and-conquer eigenvalue algorithm: Difference between revisions

From HandWiki
imported>Wikisleeper
simplify
 
MainAI (talk | contribs)
update
 
Line 1: Line 1:
{{Short description|Algorithm on Hermitian matrices}}
{{Multiple issues|
{{More footnotes needed|date=May 2024}}
}}
'''Divide-and-conquer eigenvalue algorithms''' are a class of [[Eigenvalue algorithm|eigenvalue algorithm]]s for [[Hermitian matrix|Hermitian]] or [[Real number|real]] [[Symmetric matrix|symmetric matrices]] that have recently (circa 1990s) become competitive in terms of [[Numerical stability|stability]] and [[Computational complexity theory|efficiency]] with more traditional algorithms such as the [[QR algorithm]].  The basic concept behind these algorithms is the [[Divide and conquer algorithm|divide-and-conquer]] approach from [[Computer science|computer science]].  An eigenvalue problem is divided into two problems of roughly half the size, each of these are solved [[Recursion|recursively]], and the eigenvalues of the original problem are computed from the results of these smaller problems.
'''Divide-and-conquer eigenvalue algorithms''' are a class of [[Eigenvalue algorithm|eigenvalue algorithm]]s for [[Hermitian matrix|Hermitian]] or [[Real number|real]] [[Symmetric matrix|symmetric matrices]] that have recently (circa 1990s) become competitive in terms of [[Numerical stability|stability]] and [[Computational complexity theory|efficiency]] with more traditional algorithms such as the [[QR algorithm]].  The basic concept behind these algorithms is the [[Divide and conquer algorithm|divide-and-conquer]] approach from [[Computer science|computer science]].  An eigenvalue problem is divided into two problems of roughly half the size, each of these are solved [[Recursion|recursively]], and the eigenvalues of the original problem are computed from the results of these smaller problems.
Here we present the simplest version of a divide-and-conquer algorithm, similar to the one originally proposed by Cuppen in 1981.  Many details that lie outside the scope of this article will be omitted; however, without considering these details, the algorithm is not fully stable.
 
This article covers the basic idea of the algorithm as originally proposed by Cuppen in 1981, which is not numerically stable without additional refinements.


==Background==
==Background==
Line 9: Line 15:
The eigenvalues and eigenvectors of <math>T</math> are simply those of <math>T_{1}</math> and <math>T_{2}</math>, and it will almost always be faster to solve these two smaller problems than to solve the original problem all at once.  This technique can be used to improve the efficiency of many eigenvalue algorithms, but it has special significance to divide-and-conquer.
The eigenvalues and eigenvectors of <math>T</math> are simply those of <math>T_{1}</math> and <math>T_{2}</math>, and it will almost always be faster to solve these two smaller problems than to solve the original problem all at once.  This technique can be used to improve the efficiency of many eigenvalue algorithms, but it has special significance to divide-and-conquer.


For the rest of this article, we will assume the input to the divide-and-conquer algorithm is an <math>m \times m</math> real symmetric tridiagonal matrix <math>T</math>.  Although the algorithm can be modified for Hermitian matrices, we do not give the details here.
For the rest of this article, we will assume the input to the divide-and-conquer algorithm is an <math>m \times m</math> real symmetric tridiagonal matrix <math>T</math>.  The algorithm can be modified for Hermitian matrices.


==Divide==
==Divide==
Line 15: Line 21:
The ''divide'' part of the divide-and-conquer algorithm comes from the realization that a tridiagonal matrix is "almost" block diagonal.
The ''divide'' part of the divide-and-conquer algorithm comes from the realization that a tridiagonal matrix is "almost" block diagonal.
<!-- For original TeX, see image description page -->
<!-- For original TeX, see image description page -->
:[[Image:Almost block diagonal.png]]
:Image:Almost block diagonal.png


The size of submatrix <math>T_{1}</math> we will call <math>n \times n</math>, and then <math>T_{2}</math> is <math>(m - n) \times (m - n)</math>.  Note that the remark about <math>T</math> being almost block diagonal is true regardless of how <math>n</math> is chosen (i.e., there are many ways to so decompose the matrix)However, it makes sense, from an efficiency standpoint, to choose <math>n \approx m/2</math>.  
The size of submatrix <math>T_{1}</math> we will call <math>n \times n</math>, and then <math>T_{2}</math> is <math>(m - n) \times (m - n)</math>.  <math>T</math> is almost block diagonal regardless of how <math>n</math> is chosen.  For efficiency we typically choose <math>n \approx m/2</math>.


We write <math>T</math> as a block diagonal matrix, plus a [[Rank (linear algebra)|rank-1]] correction:
We write <math>T</math> as a block diagonal matrix, plus a [[Rank (linear algebra)|rank-1]] correction:
<!-- For original TeX, see image description page -->
<!-- For original TeX, see image description page -->
:[[Image:Block diagonal plus correction.png]]
:Image:Block diagonal plus correction.png


The only difference between <math>T_{1}</math> and <math>\hat{T}_{1}</math> is that the lower right entry <math>t_{nn}</math> in <math>\hat{T}_{1}</math> has been replaced with <math>t_{nn} - \beta</math> and similarly, in <math>\hat{T}_{2}</math> the top left entry <math>t_{n+1,n+1}</math> has been replaced with <math>t_{n+1,n+1} - \beta</math>.
The only difference between <math>T_{1}</math> and <math>\hat{T}_{1}</math> is that the lower right entry <math>t_{nn}</math> in <math>\hat{T}_{1}</math> has been replaced with <math>t_{nn} - \beta</math> and similarly, in <math>\hat{T}_{2}</math> the top left entry <math>t_{n+1,n+1}</math> has been replaced with <math>t_{n+1,n+1} - \beta</math>.


The remainder of the divide step is to solve for the eigenvalues (and if desired the eigenvectors) of <math>\hat{T}_{1}</math> and <math>\hat{T}_{2}</math>, that is to find the [[Diagonalizable matrix|diagonalization]]s <math>\hat{T}_{1} = Q_{1} D_{1} Q_{1}^{T}</math> and <math>\hat{T}_{2} = Q_{2} D_{2} Q_{2}^{T}</math>.  This can be accomplished with recursive calls to the divide-and-conquer algorithm, although practical implementations often switch to the QR algorithm for small enough submatrices.
The remainder of the divide step is to solve for the eigenvalues (and if desired the eigenvectors) of <math>\hat{T}_{1}</math> and <math>\hat{T}_{2}</math>, that is to find the [[Diagonalizable matrix|diagonalization]]s <math>\hat{T}_{1} = Q_{1} D_{1} Q_{1}^{T}</math> and <math>\hat{T}_{2} = Q_{2} D_{2} Q_{2}^{T}</math>.  This can be accomplished with recursive calls to the divide-and-conquer algorithm, although practical implementations often switch to the [[QR algorithm|implicitly shifted QR algorithm]] for small enough submatrices.<ref name=":0">{{Cite book |last=Demmel |first=James W. |url=https://www.stat.uchicago.edu/~lekheng/courses/309/books/Demmel.pdf |title=Applied Numerical Linear Algebra |publisher=Society for Industrial and Applied Mathematics |year=1997 |isbn=9780898713893 |pages=216–228}}</ref>


==Conquer==
==Conquer==
Line 34: Line 40:
:<math>T = \begin{bmatrix} Q_{1} & \\ & Q_{2} \end{bmatrix} \left( \begin{bmatrix} D_{1} & \\ & D_{2} \end{bmatrix} + \beta z z^{T} \right) \begin{bmatrix} Q_{1}^{T} & \\ & Q_{2}^{T} \end{bmatrix}</math>
:<math>T = \begin{bmatrix} Q_{1} & \\ & Q_{2} \end{bmatrix} \left( \begin{bmatrix} D_{1} & \\ & D_{2} \end{bmatrix} + \beta z z^{T} \right) \begin{bmatrix} Q_{1}^{T} & \\ & Q_{2}^{T} \end{bmatrix}</math>


The remaining task has been reduced to finding the eigenvalues of a diagonal matrix plus a rank-one correction.  Before showing how to do this, let us simplify the notation.  We are looking for the eigenvalues of the matrix <math>D + w w^{T}</math>, where <math>D</math> is diagonal with distinct entries and <math>w</math> is any vector with nonzero entries.
The remaining task has been reduced to finding the eigenvalues of a diagonal matrix plus a rank-one correction.  Before showing how to do this, let us simplify the notation.  We are looking for the eigenvalues of the matrix <math>D + w w^{T}</math>, where <math>D</math> is diagonal with distinct entries and <math>w</math> is any vector with nonzero entries. In this case <math>w = \sqrt{|\beta|}\cdot z</math>.


The case of a zero entry is simple, since if w<sub>i</sub> is zero, (<math>e_i</math>,d<sub>i</sub>) is an eigenpair (<math>e_i</math> is in the standard basis) of <math>D + w w^{T}</math> since
The case of a zero entry is simple, since if w<sub>i</sub> is zero, (<math>e_i</math>,d<sub>i</sub>) is an eigenpair (<math>e_i</math> is in the standard basis) of <math>D + w w^{T}</math> since
Line 51: Line 57:
This equation is known as the ''secular equation''. The problem has therefore been reduced to finding the roots of the [[Rational function|rational function]] defined by the left-hand side of this equation.
This equation is known as the ''secular equation''. The problem has therefore been reduced to finding the roots of the [[Rational function|rational function]] defined by the left-hand side of this equation.


All general eigenvalue algorithms must be iterative, and the divide-and-conquer algorithm is no different.  Solving the nonlinear secular equation requires an iterative technique, such as the [[Newton's method|Newton–Raphson method]].  However, each root can be found in [[Big O notation|O]](1) iterations, each of which requires <math>\Theta(m)</math> flops (for an <math>m</math>-degree rational function), making the cost of the iterative part of this algorithm <math>\Theta(m^{2})</math>.
Solving the nonlinear secular equation can be done using an iterative technique, such as the [[Newton's method|Newton–Raphson method]].  However, each root can be found in [[Big O notation|O]](1) iterations, each of which requires <math>\Theta(m)</math> flops (for an <math>m</math>-degree rational function), making the cost of the iterative part of this algorithm <math>\Theta(m^{2})</math>. The [[Fast multipole method|fast multipole method]] has also been employed to solve the secular equation in <math>\Theta(m \log(m))</math> operations.<ref>{{Cite journal |last=Livne |first=Oren E. |last2=Brandt |first2=Achi |title=N Roots of the Secular Equation in O(N) Operations |url=https://epubs.siam.org/doi/10.1137/S0895479801383695 |journal=SIAM Journal on Matrix Analysis and Applications |volume=24 |issue=2 |pages=439–453 |doi=10.1137/S0895479801383695 |issn=0895-4798|url-access=subscription }}</ref><ref name=":0" />


==Analysis==
==Analysis==


As is common for divide and conquer algorithms, we will use the [[Master theorem (analysis of algorithms)|master theorem for divide-and-conquer recurrences]] to analyze the running time.  Remember that above we stated we choose <math>n \approx m/2</math>.  We can write the [[Recurrence relation|recurrence relation]]:
W will use the [[Master theorem (analysis of algorithms)|master theorem for divide-and-conquer recurrences]] to analyze the running time.  Remember that above we stated we choose <math>n \approx m/2</math>.  We can write the [[Recurrence relation|recurrence relation]]:
:<math>T(m) = 2 \times T\left(\frac{m}{2}\right) + \Theta(m^{2})</math>
:<math>T(m) = 2 \times T\left(\frac{m}{2}\right) + \Theta(m^{2})</math>
In the notation of the Master theorem, <math>a = b = 2</math> and thus <math>\log_{b} a = 1</math>.  Clearly, <math>\Theta(m^{2}) = \Omega(m^{1})</math>, so we have
In the notation of the Master theorem, <math>a = b = 2</math> and thus <math>\log_{b} a = 1</math>.  Clearly, <math>\Theta(m^{2}) = \Omega(m^{1})</math>, so we have
:<math>T(m) = \Theta(m^{2})</math>
:<math>T(m) = \Theta(m^{2})</math>


Remember that above we pointed out that reducing a Hermitian matrix to tridiagonal form takes <math>\frac{4}{3}m^{3}</math> flops.  This dwarfs the running time of the divide-and-conquer part, and at this point it is not clear what advantage the divide-and-conquer algorithm offers over the QR algorithm (which also takes <math>\Theta(m^{2})</math> flops for tridiagonal matrices).
Above, we pointed out that reducing a Hermitian matrix to tridiagonal form takes <math>\frac{4}{3}m^{3}</math> flops.  This dwarfs the running time of the divide-and-conquer part, and at this point it is not clear what advantage the divide-and-conquer algorithm offers over the QR algorithm (which also takes <math>\Theta(m^{2})</math> flops for tridiagonal matrices).


The advantage of divide-and-conquer comes when eigenvectors are needed as well.  If this is the case, reduction to tridiagonal form takes <math>\frac{8}{3}m^{3}</math>, but the second part of the algorithm takes <math>\Theta(m^{3})</math> as well.  For the QR algorithm with a reasonable target precision, this is <math>\approx 6 m^{3}</math>, whereas for divide-and-conquer it is <math>\approx \frac{4}{3}m^{3}</math>.  The reason for this improvement is that in divide-and-conquer, the <math>\Theta(m^{3})</math> part of the algorithm (multiplying <math>Q</math> matrices) is separate from the iteration, whereas in QR, this must occur in every iterative step.  Adding the <math>\frac{8}{3}m^{3}</math> flops for the reduction, the total improvement is from <math>\approx 9 m^{3}</math> to <math>\approx 4 m^{3}</math> flops.
The advantage of divide-and-conquer comes when eigenvectors are needed as well.  If this is the case, reduction to tridiagonal form takes <math>\frac{8}{3}m^{3}</math>, but the second part of the algorithm takes <math>\Theta(m^{3})</math> as well.  For the QR algorithm with a reasonable target precision, this is <math>\approx 6 m^{3}</math>, whereas for divide-and-conquer it is <math>\approx \frac{4}{3}m^{3}</math>.  The reason for this improvement is that in divide-and-conquer, the <math>\Theta(m^{3})</math> part of the algorithm (multiplying <math>Q</math> matrices) is separate from the iteration, whereas in QR, this must occur in every iterative step.  Adding the <math>\frac{8}{3}m^{3}</math> flops for the reduction, the total improvement is from <math>\approx 9 m^{3}</math> to <math>\approx 4 m^{3}</math> flops.
Line 68: Line 74:
==Variants and implementation==
==Variants and implementation==


The algorithm presented here is the simplest version.  In many practical implementations, more complicated rank-1 corrections are used to guarantee stability; some variants even use rank-2 corrections.{{Citation needed|date=September 2011}}


There exist specialized root-finding techniques for rational functions that may do better than the Newton-Raphson method in terms of both performance and stability.  These can be used to improve the iterative part of the divide-and-conquer algorithm.
There exist specialized root-finding techniques for rational functions that may do better than the Newton-Raphson method in terms of both performance and stability.  These can be used to improve the iterative part of the divide-and-conquer algorithm.


The divide-and-conquer algorithm is readily [[Parallel algorithm|parallelized]], and [[Linear algebra|linear algebra]] computing packages such as [[Software:LAPACK|LAPACK]] contain high-quality parallel implementations.{{Citation needed|date=September 2023}}


==References==
==References==
{{Reflist}}
*{{citation
*{{citation
  | mr = 1463942
  | mr = 1463942
Line 83: Line 88:
  | year = 1997}}.
  | year = 1997}}.
* {{cite journal |first1=J.J.M. |last1=Cuppen |title=A Divide and Conquer Method for the Symmetric Tridiagonal Eigenproblem |journal=[[Numerische Mathematik]] |volume=36 |pages=177–195 |date=1981 |issue=2 |doi=10.1007/BF01396757 |s2cid=120504744 }}
* {{cite journal |first1=J.J.M. |last1=Cuppen |title=A Divide and Conquer Method for the Symmetric Tridiagonal Eigenproblem |journal=[[Numerische Mathematik]] |volume=36 |pages=177–195 |date=1981 |issue=2 |doi=10.1007/BF01396757 |s2cid=120504744 }}


{{Numerical linear algebra}}
{{Numerical linear algebra}}

Latest revision as of 11:59, 14 April 2026

Short description: Algorithm on Hermitian matrices

Divide-and-conquer eigenvalue algorithms are a class of eigenvalue algorithms for Hermitian or real symmetric matrices that have recently (circa 1990s) become competitive in terms of stability and efficiency with more traditional algorithms such as the QR algorithm. The basic concept behind these algorithms is the divide-and-conquer approach from computer science. An eigenvalue problem is divided into two problems of roughly half the size, each of these are solved recursively, and the eigenvalues of the original problem are computed from the results of these smaller problems.

This article covers the basic idea of the algorithm as originally proposed by Cuppen in 1981, which is not numerically stable without additional refinements.

Background

As with most eigenvalue algorithms for Hermitian matrices, divide-and-conquer begins with a reduction to tridiagonal form. For an m×m matrix, the standard method for this, via Householder reflections, takes 43m3 floating point operations, or 83m3 if eigenvectors are needed as well. There are other algorithms, such as the Arnoldi iteration, which may do better for certain classes of matrices; we will not consider this further here.

In certain cases, it is possible to deflate an eigenvalue problem into smaller problems. Consider a block diagonal matrix

T=[T100T2].

The eigenvalues and eigenvectors of T are simply those of T1 and T2, and it will almost always be faster to solve these two smaller problems than to solve the original problem all at once. This technique can be used to improve the efficiency of many eigenvalue algorithms, but it has special significance to divide-and-conquer.

For the rest of this article, we will assume the input to the divide-and-conquer algorithm is an m×m real symmetric tridiagonal matrix T. The algorithm can be modified for Hermitian matrices.

Divide

The divide part of the divide-and-conquer algorithm comes from the realization that a tridiagonal matrix is "almost" block diagonal.

Image:Almost block diagonal.png

The size of submatrix T1 we will call n×n, and then T2 is (mn)×(mn). T is almost block diagonal regardless of how n is chosen. For efficiency we typically choose nm/2.

We write T as a block diagonal matrix, plus a rank-1 correction:

Image:Block diagonal plus correction.png

The only difference between T1 and T^1 is that the lower right entry tnn in T^1 has been replaced with tnnβ and similarly, in T^2 the top left entry tn+1,n+1 has been replaced with tn+1,n+1β.

The remainder of the divide step is to solve for the eigenvalues (and if desired the eigenvectors) of T^1 and T^2, that is to find the diagonalizations T^1=Q1D1Q1T and T^2=Q2D2Q2T. This can be accomplished with recursive calls to the divide-and-conquer algorithm, although practical implementations often switch to the implicitly shifted QR algorithm for small enough submatrices.[1]

Conquer

The conquer part of the algorithm is the unintuitive part. Given the diagonalizations of the submatrices, calculated above, how do we find the diagonalization of the original matrix?

First, define zT=(q1T,q2T), where q1T is the last row of Q1 and q2T is the first row of Q2. It is now elementary to show that

T=[Q1Q2]([D1D2]+βzzT)[Q1TQ2T]

The remaining task has been reduced to finding the eigenvalues of a diagonal matrix plus a rank-one correction. Before showing how to do this, let us simplify the notation. We are looking for the eigenvalues of the matrix D+wwT, where D is diagonal with distinct entries and w is any vector with nonzero entries. In this case w=|β|z.

The case of a zero entry is simple, since if wi is zero, (ei,di) is an eigenpair (ei is in the standard basis) of D+wwT since (D+wwT)ei=Dei=diei.

If λ is an eigenvalue, we have:

(D+wwT)q=λq

where q is the corresponding eigenvector. Now

(DλI)q+w(wTq)=0
q+(DλI)1w(wTq)=0
wTq+wT(DλI)1w(wTq)=0

Keep in mind that wTq is a nonzero scalar. Neither w nor q are zero. If wTq were to be zero, q would be an eigenvector of D by (D+wwT)q=λq. If that were the case, q would contain only one nonzero position since D is distinct diagonal and thus the inner product wTq can not be zero after all. Therefore, we have:

1+wT(DλI)1w=0

or written as a scalar equation,

1+j=1mwj2djλ=0.

This equation is known as the secular equation. The problem has therefore been reduced to finding the roots of the rational function defined by the left-hand side of this equation.

Solving the nonlinear secular equation can be done using an iterative technique, such as the Newton–Raphson method. However, each root can be found in O(1) iterations, each of which requires Θ(m) flops (for an m-degree rational function), making the cost of the iterative part of this algorithm Θ(m2). The fast multipole method has also been employed to solve the secular equation in Θ(mlog(m)) operations.[2][1]

Analysis

W will use the master theorem for divide-and-conquer recurrences to analyze the running time. Remember that above we stated we choose nm/2. We can write the recurrence relation:

T(m)=2×T(m2)+Θ(m2)

In the notation of the Master theorem, a=b=2 and thus logba=1. Clearly, Θ(m2)=Ω(m1), so we have

T(m)=Θ(m2)

Above, we pointed out that reducing a Hermitian matrix to tridiagonal form takes 43m3 flops. This dwarfs the running time of the divide-and-conquer part, and at this point it is not clear what advantage the divide-and-conquer algorithm offers over the QR algorithm (which also takes Θ(m2) flops for tridiagonal matrices).

The advantage of divide-and-conquer comes when eigenvectors are needed as well. If this is the case, reduction to tridiagonal form takes 83m3, but the second part of the algorithm takes Θ(m3) as well. For the QR algorithm with a reasonable target precision, this is 6m3, whereas for divide-and-conquer it is 43m3. The reason for this improvement is that in divide-and-conquer, the Θ(m3) part of the algorithm (multiplying Q matrices) is separate from the iteration, whereas in QR, this must occur in every iterative step. Adding the 83m3 flops for the reduction, the total improvement is from 9m3 to 4m3 flops.

Practical use of the divide-and-conquer algorithm has shown that in most realistic eigenvalue problems, the algorithm actually does better than this. The reason is that very often the matrices Q and the vectors z tend to be numerically sparse, meaning that they have many entries with values smaller than the floating point precision, allowing for numerical deflation, i.e. breaking the problem into uncoupled subproblems.

Variants and implementation

There exist specialized root-finding techniques for rational functions that may do better than the Newton-Raphson method in terms of both performance and stability. These can be used to improve the iterative part of the divide-and-conquer algorithm.


References

  1. 1.0 1.1 Demmel, James W. (1997). Applied Numerical Linear Algebra. Society for Industrial and Applied Mathematics. pp. 216–228. ISBN 9780898713893. https://www.stat.uchicago.edu/~lekheng/courses/309/books/Demmel.pdf. 
  2. Livne, Oren E.; Brandt, Achi. "N Roots of the Secular Equation in O(N) Operations". SIAM Journal on Matrix Analysis and Applications 24 (2): 439–453. doi:10.1137/S0895479801383695. ISSN 0895-4798. https://epubs.siam.org/doi/10.1137/S0895479801383695.