Class Eigensolver2x2

java.lang.Object
imagingbook.common.math.eigen.Eigensolver2x2
All Implemented Interfaces:
RealEigenDecomposition

public class Eigensolver2x2 extends Object implements RealEigenDecomposition

Implements an efficient, closed form algorithm for calculating the real eigenvalues (λ) and eigenvectors (x) of a 2x2 matrix of the form

   | a b |
   | c d |
 

There are typically (but not always) two pairs of real-valued solutions ⟨λ0, x0⟩, ⟨λ1, x1⟩ such that A·xk = λk·xk. The resulting eigensystems are ordered such that λ0 ≥ λ1. Eigenvectors are not normalized, i.e., no unit vectors (any scalar multiple of an Eigenvector is an Eigenvector too). Non-real eigenvalues are not handled. Clients should call method hasComplexEigenvalues() to check if the eigenvalue calculation was successful.

This implementation is inspired by Ch. 5 ("Consider the Lowly 2x2 Matrix") of [1]. Note that Blinn uses the notation x·A = λ·x for the matrix-vector product (as common in computer graphics), while this implementation uses A·x = λ·x. Thus x is treated as a column vector and matrix A is transposed (elements b/c are exchanged). See Appendix Sec. B.5 of [2] for more details.

This implementation is considerably faster (ca. factor 5) than the general solution (e.g., EigenDecompositionJama) for 2x2 matrices.

[1] Blinn, Jim: "Jim Blinn's Corner: Notation, Notation, Notation", Morgan Kaufmann (2002).
[2] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

Version:
2022/02/18
See Also: