From f5f697482ad64702aeaa942ccac2dfb04db7ff9c Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:08:41 +0800 Subject: [PATCH 1/9] Fix equation rendering --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8ba54e2..157b1e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Python 3](http://img.shields.io/badge/python-3-blue.svg)](https://docs.python.org/3/) +[![This project supports Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://python.org/downloads) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/theochem/matrix-permanent/actions/workflows/pull_request.yml) [![GNU GPLv3](https://img.shields.io/badge/license-%20%20GNU%20GPLv3%20-green?style=plastic)](https://www.gnu.org/licenses/gpl-3.0.en.html) @@ -37,9 +37,10 @@ Compute the permanent of a matrix using the best algorithm for the shape of the Compute the permanent of a matrix combinatorically. **Formula:** -```math + +$$ \text{per}(A) = \sum_{\sigma \in P(N,M)}{\prod_{i=1}^M{a_{i,{\sigma(i)}}}} -``` +$$ **Parameters:** @@ -55,29 +56,29 @@ Compute the permanent of a matrix combinatorically. **Formula:** -```math +$$ \text{per}(A) = \frac{1}{2^{N-1}} \cdot \sum_{\delta \in \left[\delta_1 = 1,~ \delta_2 \dots \delta_N=\pm1\right]}{ \left(\sum_{k=1}^N{\delta_k}\right){\prod_{j=1}^N{\sum_{i=1}^N{\delta_i a_{i,j}}}}} -``` +$$ **Additional Information:** The original formula has been generalized here to work with $M$-by-$N$ rectangular permanents with $M \leq N$ by use of the following identity (shown here for $M \geq N$): -```math +$$ \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) -``` +$$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: -```math +$$ \text{per}(A) = \frac{1}{2^{N-1}} \cdot \frac{1}{(N - M + 1)!}\cdot \sum_{\delta \in \left[\delta_1 = 1,~ \delta_2 \dots \delta_N=\pm1\right]}{ \left(\sum_{k=1}^N{\delta_k}\right) \prod_{j=1}^N{\left( \sum_{i=1}^M{\delta_i a_{i,j}} + \sum_{i=M+1}^N{\delta_i} \right)} } -``` +$$ **Parameters:** @@ -93,7 +94,7 @@ This can be neatly fit into the original formula by extending the inner sums ove **Formula:** -```math +$$ \text{per}(A) = \sum_{k=0}^{M-1}{ {(-1)}^k \binom{N - M + k}{k} @@ -103,7 +104,7 @@ This can be neatly fit into the original formula by extending the inner sums ove } } } -``` +$$ **Parameters:** @@ -181,4 +182,4 @@ is with pip. # License This code is distributed under the GNU General Public License version 3 (GPLv3). -See for more information. \ No newline at end of file +See for more information. From c317963f2fcf7a1469f65b6e4f376602b30cd928 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:17:11 +0800 Subject: [PATCH 2/9] Use https instead of http --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 157b1e0..2979fb3 100644 --- a/README.md +++ b/README.md @@ -182,4 +182,4 @@ is with pip. # License This code is distributed under the GNU General Public License version 3 (GPLv3). -See for more information. +See for more information. From c719bb6092c1f57004681791b526085ccb396d03 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:20:38 +0800 Subject: [PATCH 3/9] Fix the misaligned equations --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2979fb3..64ce023 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,9 @@ The original formula has been generalized here to work with $M$-by-$N$ rectangul $M \leq N$ by use of the following identity (shown here for $M \geq N$): $$ +\begin{aligned} \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) +\end{aligned} $$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From 7aedb0865eea8c6a787ddd2eb63a8b3667219920 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:23:01 +0800 Subject: [PATCH 4/9] Another fix of misaligned equation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64ce023..6a19890 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,11 @@ The original formula has been generalized here to work with $M$-by-$N$ rectangul $M \leq N$ by use of the following identity (shown here for $M \geq N$): $$ +\begin{equation*} \begin{aligned} \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) \end{aligned} +\end{equation*} $$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From 1fa5341b91c5d220edf1c777a44a03a3b738b2bf Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:27:29 +0800 Subject: [PATCH 5/9] Fix the equation rendering --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6a19890..8fa811b 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,22 @@ The original formula has been generalized here to work with $M$-by-$N$ rectangul $M \leq N$ by use of the following identity (shown here for $M \geq N$): $$ -\begin{equation*} -\begin{aligned} -\text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) -\end{aligned} -\end{equation*} +\operatorname{per}\!\left( +\begin{matrix} +a_{1,1} & \cdots & a_{1,N} \\ +\vdots & \ddots & \vdots \\ +a_{M,1} & \cdots & a_{M,N} +\end{matrix} +\right) += +\frac{1}{(M-N+1)!}\,\cdot +\operatorname{per}\! \left( +\begin{matrix} +a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ +\vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ +a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M} +\end{matrix} +\right) $$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From 3526bb1969fa8531f8452f723a693d4987671f8e Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:30:04 +0800 Subject: [PATCH 6/9] Fix equation rendering --- README.md | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8fa811b..6a19890 100644 --- a/README.md +++ b/README.md @@ -66,22 +66,11 @@ The original formula has been generalized here to work with $M$-by-$N$ rectangul $M \leq N$ by use of the following identity (shown here for $M \geq N$): $$ -\operatorname{per}\!\left( -\begin{matrix} -a_{1,1} & \cdots & a_{1,N} \\ -\vdots & \ddots & \vdots \\ -a_{M,1} & \cdots & a_{M,N} -\end{matrix} -\right) -= -\frac{1}{(M-N+1)!}\,\cdot -\operatorname{per}\! \left( -\begin{matrix} -a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ -\vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ -a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M} -\end{matrix} -\right) +\begin{equation*} +\begin{aligned} +\text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) +\end{aligned} +\end{equation*} $$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From 186789ea6f438826d0359438bc60db350515c924 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:32:08 +0800 Subject: [PATCH 7/9] Fix the equation rendering --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 6a19890..2979fb3 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,7 @@ The original formula has been generalized here to work with $M$-by-$N$ rectangul $M \leq N$ by use of the following identity (shown here for $M \geq N$): $$ -\begin{equation*} -\begin{aligned} \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) -\end{aligned} -\end{equation*} $$ This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From 6e38f200e10fe2e8c830f232c814c20d65f558d8 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:33:14 +0800 Subject: [PATCH 8/9] Fix the equation rendering --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2979fb3..88ac4c0 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ $$ The original formula has been generalized here to work with $M$-by-$N$ rectangular permanents with $M \leq N$ by use of the following identity (shown here for $M \geq N$): -$$ +```math \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} \\ \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N}\end{matrix}\right) = \frac{1}{(M - N + 1)!} \cdot \text{per}\left(\begin{matrix}a_{1,1} & \cdots & a_{1,N} & 1_{1,N+1} & \cdots & 1_{1,M} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ a_{M,1} & \cdots & a_{M,N} & 1_{M,N+1} & \cdots & 1_{M,M}\end{matrix}\right) -$$ +``` This can be neatly fit into the original formula by extending the inner sums over $\delta$ from $[1,M]$ to $[1,N]$: From ed051437e758e5cd0ac260667dcd9636ebfd2b31 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 23 Apr 2026 12:35:43 +0800 Subject: [PATCH 9/9] Fix equation rendering for matrix block --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88ac4c0..9c9171c 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ $$ $$ **Additional Information:** -The original formula has been generalized here to work with $M$-by-$N$ rectangular permanents with +The original formula has been generalized here to work with $M$ by $N$ rectangular permanents with $M \leq N$ by use of the following identity (shown here for $M \geq N$): ```math