Skip to content

Commit 7907519

Browse files
committed
minor improvements
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
1 parent 67f19d4 commit 7907519

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

docs/advanced_documentation/algorithms/lu-solver.md

+25-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MPL-2.0
99
Power system equations can be modeled as matrix equations. A matrix equation solver is therefore
1010
key to the power grid model.
1111

12-
This section documents the need for a custom sparse LU solver and its implementation.
12+
This section documents the need for a custom sparse LU-solver and its implementation.
1313

1414
## Background
1515

@@ -25,10 +25,11 @@ imposes some constraints on the algorithms that can be used.
2525

2626
* Highly accurate and fast calculations are needed for very large grids. This means that direct
2727
methods are strongly preferred, and approximate methods can only be used when there is no other
28-
alternative, and only if can be iteratively refined with a fast convergence rate.
28+
alternative, and only if they can be iteratively refined with a fast convergence rate.
2929
* Sometimes, very many repetitive calculations are required, e.g., for time series. In those cases,
30-
separating the decomposition of a matrix and solving two systems of equations separately can give
31-
major performance boosts.
30+
separating the decomposition (also known as factorization) of a matrix and solving two systems of
31+
equations separately can give major performance boosts, because the decomposition remains the same
32+
across the entire set of calculations.
3233

3334
### Topological structure
3435

@@ -45,7 +46,7 @@ and, as a result, extremely sparse matrix equations with a block structure.
4546

4647
Sparse matrix equations can be solved efficiently: they can be solved in linear time complexity, as
4748
opposed to the cubic complexity of naive Gaussian elimination. As a result, a sparse matrix solver
48-
is key to the performance of the power grid model. QR decomposition therefore is not a good
49+
is key to the performance of the power grid model. QR-decomposition therefore is not a good
4950
candidate.
5051

5152
#### Pivot operations
@@ -90,33 +91,33 @@ dense blocks need to be inverted separately. To make matters worse, the dense bl
9091
heavily in structure and contents between different nodes, and are often not solvable without
9192
pivoting.
9293

93-
### Custom sparse LU solver
94+
### Custom sparse LU-solver
9495

95-
The choice for a custom LU solver implementation comes from a number of considerations:
96+
The choice for a custom LU-solver implementation comes from a number of considerations:
9697

97-
* LU-decomposition is the best choice, because QR-decomposition and Cholesky decomposition cannot
98+
* LU-decomposition is the best choice, because QR-decomposition and Cholesky-decomposition cannot
9899
solve the power system equations efficiently as a consequence of the properties
99-
* Alternative LU solver implementations are optimized for a variety of use cases that are less
100+
* Alternative LU-solver implementations are optimized for a variety of use cases that are less
100101
sparse than the ones encountered in power systems.
101-
* Alternative LU solver implementations do not have good block-sparse matrix equation solvers.
102+
* Alternative LU-solver implementations do not have good block-sparse matrix equation solvers.
102103

103104
## Implementation
104105

105-
The LU solver implemented in the power grid model consists of 3 components:
106+
The LU-solver implemented in the power grid model consists of 3 components:
106107

107-
* A block-sparse LU solver that:
108+
* A block-sparse LU-solver that:
108109
* handles factorization using the topological structure up to block-level
109110
* solves the sparse matrix equation given the factorization
110-
* A dense LU factor that handles individual blocks within the matrix equation
111+
* A dense LU-factor that handles individual blocks within the matrix equation
111112

112-
### Dense LU factorization
113+
### Dense LU-factorization
113114

114115
The power grid model uses a modified version of the
115116
[`LUFullPiv` defined in Eigen](https://gitlab.com/libeigen/eigen/-/blob/3.4/Eigen/src/LU/FullPivLU.h)
116117
(credits go to the original author). The modification adds opt-in support for
117118
[pivot perturbation](#pivot-perturbation).
118119

119-
#### Dense LU factorization process
120+
#### Dense LU-factorization process
120121

121122
The Gaussian elimination process itself is as usual. Let
122123
$M_p\equiv\begin{bmatrix}m_p && \vec{r}_p^T \\ \vec{q}_p && \hat{M}_p\end{bmatrix}$, where $p$ is
@@ -160,7 +161,7 @@ $$
160161
A = P^{-1}LUQ^{-1}
161162
$$
162163

163-
#### Dense LU factorization algorithm
164+
#### Dense LU-factorization algorithm
164165

165166
The power grid model uses an in-place approach. Permutations are
166167

@@ -206,15 +207,15 @@ the `SparseMatrixError` immediately, we break from the loop and throw after that
206207
change the functional behavior.
207208
```
208209

209-
### Block-sparse LU factorization
210+
### Block-sparse LU-factorization
210211

211-
The LU factorization process for block-sparse matrices is similar to that for
212+
The LU-factorization process for block-sparse matrices is similar to that for
212213
[dense matrices](#dense-lu-factorization), but in this case, $m_p$ is a block element, and
213214
$\vec{q}_p$, $\vec{r}_p^T$ and $\hat{M}_p$ consist of block elements as well. Notice that the
214-
inverse $m_p^{-1}$ can be calculated from is LU decomposition, which can be obtained from the
215-
[dense LU factorization process](#dense-lu-factorization-process).
215+
inverse $m_p^{-1}$ can be calculated from is LU-decomposition, which can be obtained from the
216+
[dense LU-factorization process](#dense-lu-factorization-process).
216217

217-
#### Block-sparse LU factorization process
218+
#### Block-sparse LU-factorization process
218219

219220
The Gaussian elimination process itself is as usual. Completely analogously to and following the
220221
same conventions as [before](#dense-lu-factorization-process), let
@@ -409,7 +410,7 @@ obtained here is an approximation of the exact solution. The approximation can b
409410

410411
### Pivot perturbation
411412

412-
The LU solver implemented in the power grid model has support for pivot perturbation. The methods
413+
The LU-solver implemented in the power grid model has support for pivot perturbation. The methods
413414
are described in
414415
[Li99](https://www.semanticscholar.org/paper/A-Scalable-Sparse-Direct-Solver-Using-Static-Li-Demmel/7ea1c3360826ad3996f387eeb6d70815e1eb3761)
415416
and
@@ -442,7 +443,7 @@ be the matrix, $\left\|M\right\|_{\infty ,\text{bwod}}$ the
442443
$\text{direction}$ ensures that the complex phase of the pivot element is preserved, with a fallback
443444
the positive real axis when the pivot element is identically zero.
444445

445-
### Iterative refinement of LU solver solutions
446+
### Iterative refinement of LU-solver solutions
446447

447448
This algorithm is heavily inspired by the GESP algorithm described in
448449
[Li99](https://www.semanticscholar.org/paper/A-Scalable-Sparse-Direct-Solver-Using-Static-Li-Demmel/7ea1c3360826ad3996f387eeb6d70815e1eb3761).
@@ -464,7 +465,7 @@ back into $x_{i+1} = x_i + \Delta x$ provides the next best approximation $x_{i+
464465
A measure for the quality of the approximation is given by the $\text{backward_error}$ (see also
465466
[backward error formula](#improved-backward-error-calculation)).
466467

467-
Since the matrix $A$ does not change during this process, the LU decomposition remains valid
468+
Since the matrix $A$ does not change during this process, the LU-decomposition remains valid
468469
throughout the process, so that this iterative refinement can be done at a reasonably low cost.
469470

470471
Given the original matrix equation $A \cdot x = b$ to solve, the pivot perturbated matrix

0 commit comments

Comments
 (0)