The decoding of QLDPC code has the following relationship
$$
\begin{bmatrix}
D \ D_L
\end{bmatrix}\vec{e} = \begin{bmatrix}
\vec{s'} \ \vec{s}_L
\end{bmatrix}
$$
where
The lower hamming weights in
To test the logical syndrome rate, we randomly sample the error by the prior probability, and log the syndrome and true logical syndrome by $$ \begin{bmatrix} D \ D_L \end{bmatrix}\vec{e} = \begin{bmatrix} \vec{s'} \ \vec{s}_L \end{bmatrix} $$ Then we seed the syndrome to the decoder and get the decoded logical syndrome. If the decoding matches with the true logical syndrome, the decoding success. the logical error rate is the success rate of decoding.
When
For binary variables, this means:
The energy term becomes:
Since
The optimization becomes:
This can be rewritten as: $$\vec{s}^* = \arg\min_{\vec{s}} e^{-\vec{w}1^T \vec{s}} \sum{\vec{e}_2} \exp\left(-\vec{w}_1^T B\vec{e}_2 - \vec{w}_2^T \vec{e}_2 + 2\vec{w}_1^T (\vec{s} \odot B\vec{e}_2)\right)$$
$$\ln \vec{s_L}^* = \arg\min_{\vec{s}=\begin{bmatrix}
\vec{s'} \ \vec{s}_L
\end{bmatrix}} -\vec{w}1^T \vec{s}+ \ln \sum{\vec{e}_2} \exp\left(-\vec{w}_1^T B\vec{e}_2 - \vec{w}_2^T \vec{e}_2 + 2\vec{w}_1^T (\vec{s} \odot B\vec{e}_2)\right)$$
Here,
The lower hamming weights in
Write a cpp implementation of the above algorithm. You should also write a test function to test the logical syndrome rate by repeat generation error using the prior probability and then using the decoding equation to get the syndrome and the logical syndrome, if the decoded logical syndrome matches the original logical syndrome, the decoding success. The logical syndrome rate is the success times/ all repeat times.
I want to minimize