-
Notifications
You must be signed in to change notification settings - Fork 73
CI: use pymarkdownlnt #1502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
CI: use pymarkdownlnt #1502
Changes from all commits
38a2b6a
79f85fa
f9178a0
c90bea1
63e1fa3
52d33ec
66fde6c
758869d
80b3af6
85ef0c9
40f5a3f
5857ad6
0f94fe8
b00316c
7bd1df9
3d48a4d
f956d1c
809d4ca
26e32d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "plugins": { | ||
| "heading-increment": { | ||
| "enabled": false | ||
| }, | ||
| "no-duplicate-heading": { | ||
| "enabled": false | ||
| }, | ||
| "line-length": { | ||
| "enabled": true, | ||
| "tables": false, | ||
| "line_length": 120, | ||
| "heading_line_length": 120, | ||
| "code_block_line_length": 120 | ||
| } | ||
| }, | ||
| "extensions": { | ||
| "front-matter": { | ||
| "enabled": true | ||
| }, | ||
| "linter-pragmas": { | ||
| "enabled": true | ||
| }, | ||
| "markdown-tables": { | ||
| "enabled": true | ||
| }, | ||
| "markdown-task-list-items": { | ||
| "enabled": false | ||
| }, | ||
| "markdown-strikethrough": { | ||
| "enabled": false | ||
| }, | ||
| "markdown-disallow-raw-html": { | ||
| "enabled": false | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -303,6 +303,7 @@ where $i,j = 0..(N-1)$. | |
| For readbility, we use $:$ to denote a range slicing operation to along a dimension of matrix $\mathbf{M}$, e.g. | ||
| $\mathbf{M}\left[0:3, j\right]$. | ||
|
|
||
| <!-- pyml disable line-length --> | ||
| 1. Initialize the permutations $\mathbf{P}$ and $\mathbf{Q}$ to the identity permutation. | ||
| 2. Initialize fill-in elements to $0$. | ||
| 3. Loop over all rows: $p = 0..(N-1)$: | ||
|
|
@@ -326,11 +327,12 @@ $\mathbf{M}\left[0:3, j\right]$. | |
| 2. $\mathbf{M}_p\left[0:N_p,0\right] \leftrightarrow \mathbf{M}\left[0:N_p,j_p\right]$ | ||
| 6. Apply Gaussian elimination for the current pivot element: | ||
| 1. $\mathbf{M}_p\left[0,0:N_p\right] \gets \frac{1}{\mathbf{M}_p[0,0]}\mathbf{M}_p\left[0,0:N_p\right]$ | ||
| 2. $\mathbf{M}_p\left[1:N_p,0:N_p\right] \gets \mathbf{M}_p\left[1:N_p,0:N_p\right] - \mathbf{M}_p\left[1:N_p,0\right] \otimes \mathbf{M}_p\left[0,0:N_p\right]$ <!-- markdownlint-disable-line line-length --> | ||
| 2. $\mathbf{M}_p\left[1:N_p,0:N_p\right] \gets \mathbf{M}_p\left[1:N_p,0:N_p\right] - \mathbf{M}_p\left[1:N_p,0\right] \otimes \mathbf{M}_p\left[0,0:N_p\right]$ | ||
| 7. Accumulate the permutation matrices: | ||
| 1. In $\mathbf{P}$: swap $p \leftrightarrow p + i_p$ | ||
| 2. In $\mathbf{Q}$: swap $p \leftrightarrow p + j_p$ | ||
| 8. Continue with the next $p$ to factorize the the bottom-right block. | ||
| <!-- pyml enable line-length --> | ||
|
|
||
| $\mathbf{L}$ is now the matrix containing the lower triangle of $\mathbf{M}$, ones on the diagonal and zeros in the | ||
| upper triangle. | ||
|
|
@@ -801,7 +803,7 @@ The equation $\mathbf{L}\boldsymbol{y} = \mathbf{P}\boldsymbol{b}$ is solved as | |
|
|
||
| 1. Loop over all block-rows: $i=0..(N-1)$: | ||
| 1. Loop over all lower-triangle off-diagonal columns (beware of sparsity): $j=0..(i-1)$: | ||
| 1. $\boldsymbol{b}\left[i\right] \gets \boldsymbol{b}\left[i\right] - \mathbf{L}\left[i,j\right] \cdot \boldsymbol{b}\left[j\right]$. <!-- markdownlint-disable-line line-length --> | ||
| 1. $\boldsymbol{b}\left[i\right] \gets \boldsymbol{b}\left[i\right] - \mathbf{L}\left[i,j\right] \cdot \boldsymbol{b}\left[j\right]$. | ||
| 2. Continue with next block-column. | ||
| 2. If the matrix is a block matrix: | ||
| 1. Follow the same steps within the block. | ||
|
|
@@ -815,7 +817,7 @@ The equation $Uz = y$ is solved as follows. | |
|
|
||
| 1. Loop over all block-rows in reverse order: $i=(N-1)..0$: | ||
| 1. Loop over all upper-triangle off-diagonal columns (beware of sparsity): $j=(i+1)..0$: | ||
| 1. $\boldsymbol{b}\left[i\right] \gets \boldsymbol{b}\left[i\right] - \mathbf{U}\left[i,j\right] \cdot \boldsymbol{b}\left[j\right]$. <!-- markdownlint-disable-line line-length --> | ||
| 1. $\boldsymbol{b}\left[i\right] \gets \boldsymbol{b}\left[i\right] - \mathbf{U}\left[i,j\right] \cdot \boldsymbol{b}\left[j\right]$. | ||
| 2. Continue with next block-column. | ||
| 2. Handle the diagonal element: | ||
| 1. If the matrix is a block matrix: | ||
|
|
@@ -871,16 +873,16 @@ as well as the well-known | |
|
|
||
| #### Pivot perturbation algorithm | ||
|
|
||
| Let $\mathbf{M}$ be the matrix, $\left\|\mathbf{M}\right\|_{\infty ,\text{bwod}}$ the | ||
| Let $\mathbf{M}$ be the matrix, $\left|\mathbf{M}\right|_{\infty ,\text{bwod}}$ the | ||
| [block-wise off-diagonal infinite norm](#block-wise-off-diagonal-infinite-matrix-norm) of the matrix. | ||
|
|
||
| 1. $\epsilon \gets \text{perturbation\_threshold} * \left\|\mathbf{M}\right\|_{\text{bwod}}$. | ||
| 2. If $|\text{pivot\_element}| \lt \epsilon$, then: | ||
| 1. If $|\text{pivot\_element}| = 0$, then: | ||
| 1. $\epsilon \gets \text{perturbation\_threshold} * \lvert\mathbf{M}\rvert_{\text{bwod}}$. | ||
| 2. If $\lvert\text{pivot\_element}\rvert \lt \epsilon$, then: | ||
| 1. If $\lvert\text{pivot\_element}\rvert = 0$, then: | ||
| 1. $\text{phase\_shift} \gets 1$. | ||
| 2. Proceed. | ||
| 2. Else: | ||
| 1. $\text{phase\_shift} \gets \text{pivot\_element} / |\text{pivot\_element}|$. | ||
| 1. $\text{phase\_shift} \gets \text{pivot\_element} / \lvert\text{pivot\_element}\rvert$. | ||
| 2. Proceed. | ||
| 3. $\text{pivot\_element} \gets \epsilon * \text{phase\_shift}$. | ||
|
|
||
|
|
@@ -909,7 +911,7 @@ The residual $\boldsymbol{r}$ can be calculated. | |
| An estimation for the left-hand side can be obtained by using the pivot-perturbed matrix $\tilde{\mathbf{M}}$ instead of | ||
| the original matrix $\mathbf{M}$. | ||
| Convergence is reached when $\boldsymbol{r} \to \boldsymbol{0}$, which implies | ||
| $\left\|\boldsymbol{\Delta x}\right\| \to 0$. | ||
| $\left|\boldsymbol{\Delta x}\right| \to 0$. | ||
| Solving for $\boldsymbol{\Delta x}$ and substituting back into | ||
| $\boldsymbol{x}_{i+1} = \boldsymbol{x}_i + \boldsymbol{\Delta x}$ provides the next best approximation | ||
| $\boldsymbol{x}_{i+1}$ for $\boldsymbol{x}$. | ||
|
|
@@ -1131,7 +1133,7 @@ with dimensions $N_i\times N_j$. | |
| 3. Loop over all rows of the current block: $k = 0..(N_{i,j} - 1)$: | ||
| 1. $\text{block\_row\_norm} \gets 0$. | ||
| 2. Loop over all columns of the current block: $l = 0..(N_{i,j} - 1)$: | ||
| 1. $\text{block\_row\_norm} \gets \text{block\_row\_norm} + \left\|\mathbf{M}_{i,j}\left[k,l\right]\right\|$. <!-- markdownlint-disable-line line-length --> | ||
| 1. $\text{block\_row\_norm} \gets \text{block\_row\_norm} + \lvert\mathbf{M}_{i,j}\left[k,l\right]\rvert$. | ||
| 3. Calculate the new block norm: set | ||
| $\text{block\_norm} \gets \max\left\{\text{block\_norm}, \text{block\_row\_norm}\right\}$. | ||
| 4. Continue with the next row of the current block. | ||
|
|
@@ -1186,10 +1188,11 @@ $$ | |
| \end{bmatrix} | ||
| $$ | ||
|
|
||
| <!-- pyml disable line-length --> | ||
| * The regular $L_{\infty}$-norm is $\max\left\{1+3, 3, 5, \frac{1}{2}, 1, 1\right\} = 5$. | ||
| * The block-wise off-diagonal infinity $L_{\infty ,\text{bwod}}$-norm is | ||
| <!-- markdownlint-disable-next-line line-length --> | ||
| $\max\left\{\max\left\{1, 3\right\}+\max\left\{3, 0\right\},\max\left\{5, 0\right\} + \max\left\{0, \frac{1}{2}\right\}, 1\right\} = \max\left\{3+3, 5+\frac{1}{2}, 1, 1\right\} = 6$. | ||
| <!-- pyml enable line-length --> | ||
|
|
||
| The two norms clearly differ and even the elements that contribute most to the norm are different. | ||
|
|
||
|
|
@@ -1214,9 +1217,10 @@ $$ | |
| \end{bmatrix} | ||
| $$ | ||
|
|
||
| <!-- pyml disable line-length --> | ||
| * The regular $L_{\infty}$-norm is $\max\left\{20+20+2+2,30+3,100,3+1\right\} = \max\left\{44,33,100,4\right\} = 100$. | ||
| * The block-wise infinity norm with diagonals would be | ||
| <!-- markdownlint-disable-next-line line-length --> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume a similar per-line disabling command doesn't exist in That's fine by me, it's the same as before but just a different "style". |
||
| $\max\left\{\max\left\{20+20, 30\right\}+\max\left\{2+2, 3\right\},\max\left\{0,3\right\} + \max\left\{100, 1\right\}\right\} = \max\left\{40+4, 3+100\right\} = \max\left\{44, 103\right\} = 103$. | ||
| * The $L_{\infty ,\text{bwod}}$-norm is | ||
| $\max\left\{\max\left\{2+2, 3\right\},\max\left\{0,3\right\}\right\} = \max\left\{4, 3\right\} = 4$. | ||
| <!-- pyml enable line-length --> | ||
Uh oh!
There was an error while loading. Please reload this page.