1. LU Factorization: The Matrix Backbone
LU Factorization (Lower-Upper) is a method of decomposing a square matrix A into the product of two triangular matrices.
- L (Lower Triangular): Has 1s on the diagonal and non-zero elements below the diagonal. It stores the "elimination steps."
- U (Upper Triangular): Has non-zero elements on and above the diagonal. It is the "reduced" form of the matrix.
Why use it? Instead of re-calculating the inverse of a matrix (which is computationally expensive), you solve Ly = b and Ux = y using forward and backward substitution.
Example 1C#
Matrix A: 4 3 2 3 2 1 2 1 3 Matrix L: 1.0000 0.0000 0.0000 0.5000 1.0000 0.0000 0.7500 0.5000 1.0000 Matrix U: 4.0000 3.0000 2.0000 0.0000 -0.5000 2.0000 0.0000 0.0000 -1.5000 Matrix P:0, 2, 1
2. Rank-1 Updates: Adjusting the Matrix
In many real-time systems (like structural engineering or machine learning), the matrix A changes slightly over time. A Rank-1 Update happens when we add the outer product of two vectors u and v to the original matrix:
If we already have the LU factorization of A, it is wasteful to re-compute the LU factorization of \tilde{A} from scratch. Re-computing takes O(n^3) operations, while updating takes only O(n^2).
3. The Sherman-Morrison Formula
While LU handles the decomposition, the Sherman-Morrison formula tells us how the inverse changes after a Rank-1 update:
4. usage in SepalSolverPython
This script demonstrates a Rank-1 update and compares the result to the standard matrix addition.
Example 2C#
Matrix A: 6 2 2 3 2 1 6 -1 3 Matrix L: 1.0000 0.0000 0.0000 1.0000 1.0000 0.0000 0.5000 -0.3333 1.0000 Matrix U: 6.0000 2.0000 2.0000 0.0000 -3.0000 1.0000 0.0000 0.0000 0.3333 Matrix P:0, 2, 1 Updated Matrix A_tilde: 6 2 2 3 2 1 6 -1 3 Matrix L: 1.0000 0.0000 0.0000 1.0000 1.0000 0.0000 0.5000 -0.3333 1.0000 Matrix U: 6.0000 2.0000 2.0000 0.0000 -3.0000 1.0000 0.0000 0.0000 0.3333 Matrix P:0, 2, 1
5. Applications in Industry
- Optimization (Quasi-Newton Methods): Used to update Hessian approximations (BFGS algorithm).
- Power Systems: When a transmission line trips, the admittance matrix undergoes a Rank-1 or Rank-2 update.
- Signal Processing: Adaptive filtering where the correlation matrix is updated with each new data point.