跳至内容

Jacobi Rotation

The Jacobi rotation method is a classical iterative algorithm used to diagonalize symmetric matrices. It is particularly well-suited for small to medium-sized matrices and is known for its simplicity and robustness. The method works by systematically eliminating off-diagonal elements through a series of orthogonal transformations (rotations), eventually converging to a diagonal matrix whose elements are the eigenvalues of the original matrix.

The Jacobi method targets the largest off-diagonal element of the matrix and applies a rotation to zero it out. This process is repeated iteratively until all off-diagonal elements are sufficiently small, resulting in a diagonal matrix. The eigenvalues of the original matrix are then found on the diagonal, and the eigenvectors are obtained from the product of all the rotation matrices applied during the process.

Principles

For a symmetric matrix AA, the goal is to find an orthogonal matrix PP such that:

D=PTAP D = P^T A P

where DD is a diagonal matrix containing the eigenvalues of AA, and the columns of PP are the corresponding eigenvectors.

The Jacobi method achieves this by applying a sequence of orthogonal transformations (rotations) to AA. Each rotation targets a specific off-diagonal element AijA_{ij} and zeroes it out.

Rotation Matrix

A Jacobi rotation matrix RR is an orthogonal matrix that differs from the identity matrix only in four elements:

R=(1000  0cosθsinθ0  0sinθcosθ0  0001) R = \begin{pmatrix} 1 & \cdots & 0 & \cdots & 0 & \cdots & 0 \\\ \vdots & \ddots & \vdots & & \vdots & & \vdots \\\ 0 & \cdots & \cos \theta & \cdots & -\sin \theta & \cdots & 0 \\\ \vdots & & \vdots & \ddots & \vdots & & \vdots \\\ 0 & \cdots & \sin \theta & \cdots & \cos \theta & \cdots & 0 \\\ \vdots & & \vdots & & \vdots & \ddots & \vdots \\\ 0 & \cdots & 0 & \cdots & 0 & \cdots & 1 \end{pmatrix}

Here, cosθ\cos \theta and sinθ\sin \theta are placed at the intersections of the ii-th and jj-th rows and columns. The angle θ\theta is chosen such that the off-diagonal element AijA_{ij} is zeroed out.

Algorithm

  1. Identify the Largest Off-Diagonal Element:

    • Find the largest off-diagonal element AijA_{ij} (in absolute value) in the matrix AA.
  2. Compute the Rotation Angle θ\theta:

    • The angle θ\theta is chosen to satisfy: tan(2θ)=2AijAiiAjj \tan(2\theta) = \frac{2A_{ij}}{A_{ii} - A_{jj}}
    • From this, compute cosθ\cos \theta and sinθ\sin \theta.
  3. Construct the Rotation Matrix RR:

    • Build the rotation matrix RR using cosθ\cos \theta and sinθ\sin \theta.
  4. Apply the Rotation:

    • Update the matrix AA as: A=RTAR A^{\prime} = R^T A R
    • This transformation zeroes out AijA_{ij} and AjiA_{ji}.
  5. Accumulate the Transformations:

    • Update the eigenvector matrix PP as: P=PR P^{\prime} = P R
    • This accumulates the rotations to form the final eigenvector matrix.
  6. Repeat Until Convergence:

    • Repeat the process until all off-diagonal elements are smaller than a specified tolerance ϵ \epsilon.

An Example

Consider a symmetric matrix AA:

A=(412 131 215) A = \begin{pmatrix} 4 & 1 & 2 \\\ 1 & 3 & 1 \\\ 2 & 1 & 5 \end{pmatrix}

Step 1: Initialize

Start with the matrix AA and an identity matrix PP to accumulate the rotations:

A=(4.0000001.0000002.000000 1.0000003.0000001.000000 2.0000001.0000005.000000),P=(1.0000000.0000000.000000 0.0000001.0000000.000000 0.0000000.0000000.000000). A = \begin{pmatrix} 4.000000 & 1.000000 & 2.000000 \\\ 1.000000 & 3.000000 & 1.000000 \\\ 2.000000 & 1.000000 & 5.000000 \end{pmatrix}, \quad P = \begin{pmatrix} 1.000000 & 0.000000 & 0.000000 \\\ 0.000000 & 1.000000 & 0.000000 \\\ 0.000000 & 0.000000 & 0.000000 \end{pmatrix}.

Step 2: Find the Largest Off-Diagonal Element

The largest off-diagonal element in AA is A13=2.000000A_{13} = 2.000000.

Step 3: Compute the Rotation Parameters

For the rotation in the (1,3)(1, 3) plane:

  • Compute the angle θ\theta:

    θ=12arctan(2A13A11A33). \theta = \frac{1}{2} \arctan\left(\frac{2A_{13}}{A_{11} - A_{33}}\right).

    Substituting the values:

    θ=12arctan(22.0000004.0000005.000000)=12arctan(4.000000). \theta = \frac{1}{2} \arctan\left(\frac{2 \cdot 2.000000}{4.000000 - 5.000000}\right) = \frac{1}{2} \arctan(-4.000000).

    Using single-precision arithmetic:

    θ0.674741radians. \theta \approx -0.674741 \, \text{radians}.
  • Compute c=cos(θ)c = \cos(\theta) and s=sin(θ)s = \sin(\theta):

    c0.780869,s0.624695. c \approx 0.780869, \quad s \approx -0.624695.

Step 4: Apply the Rotation

Construct the rotation matrix JJ:

J=(c0s 010 s0c)(0.7808690.0000000.624695 0.0000001.0000000.000000 0.6246950.0000000.780869). J = \begin{pmatrix} c & 0 & s \\\ 0 & 1 & 0 \\\ -s & 0 & c \end{pmatrix} \approx \begin{pmatrix} 0.780869 & 0.000000 & -0.624695 \\\ 0.000000 & 1.000000 & 0.000000 \\\ 0.624695 & 0.000000 & 0.780869 \end{pmatrix}.

Update AA and PP:

A=JTAJ,P=PJ. A = J^T A J, \quad P = P J.

After the rotation:

A(5.5615530.7808690.000000 0.7808693.0000000.624695 0.0000000.6246952.438447), A \approx \begin{pmatrix} 5.561553 & 0.780869 & 0.000000 \\\ 0.780869 & 3.000000 & 0.624695 \\\ 0.000000 & 0.624695 & 2.438447 \end{pmatrix},

P(0.7808690.0000000.624695 0.0000001.0000000.000000 0.6246950.0000000.780869). P \approx \begin{pmatrix} 0.780869 & 0.000000 & -0.624695 \\\ 0.000000 & 1.000000 & 0.000000 \\\ 0.624695 & 0.000000 & 0.780869 \end{pmatrix}.

Step 5: Repeat for Other Off-Diagonal Elements

Repeat the process for the next largest off-diagonal element until all off-diagonal elements are sufficiently small (e.g., below a tolerance of 10610^{-6}).

Step 6: Final Diagonalized Matrix

After convergence, the diagonalized matrix AA will be:

A(6.0000000.0000000.000000 0.0000003.0000000.000000 0.0000000.0000003.000000). A \approx \begin{pmatrix} 6.000000 & 0.000000 & 0.000000 \\\ 0.000000 & 3.000000 & 0.000000 \\\ 0.000000 & 0.000000 & 3.000000 \end{pmatrix}.

The corresponding eigenvector matrix PP will be:

P(0.7071070.0000000.707107 0.0000001.0000000.000000 0.7071070.0000000.707107). P \approx \begin{pmatrix} 0.707107 & 0.000000 & -0.707107 \\\ 0.000000 & 1.000000 & 0.000000 \\\ 0.707107 & 0.000000 & 0.707107 \end{pmatrix}.

Advantages

  • Simplicity: The algorithm is straightforward to implement.
  • Robustness: It is guaranteed to converge for symmetric matrices.
  • Accuracy: Provides highly accurate eigenvalues and eigenvectors.

Limitations

  • Slow Convergence: The method requires many iterations for large matrices.
  • Inefficiency for Large Matrices: Not suitable for very large or sparse matrices.
  • Computational Cost: Each rotation involves updating the entire matrix, which can be costly for large systems.