You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: qualtran/bloqs/gf_arithmetic/gf2_inverse.ipynb
+9-2
Original file line number
Diff line number
Diff line change
@@ -58,15 +58,22 @@
58
58
" a^{-1} = a^{2^m - 2}\n",
59
59
"$$\n",
60
60
"\n",
61
-
"Thus, the inverse can be obtained via $m - 1$ squaring and multiplication operations.\n",
61
+
"The exponential $a^{2^m - 2}$ is computed using $\\mathcal{O}(m)$ squaring and\n",
62
+
"$\\mathcal{O}(\\log_2(m))$ multiplications via Itoh-Tsujii inversion. The algorithm is described on\n",
63
+
"page 4 and 5 of Ref[1] and resembles binary exponentiation. The inverse is computed as $B_{n-1}^2$,\n",
64
+
"where $B_1 = x$ and $B_{i+j} = B_i B_j^{2^i}$.\n",
62
65
"\n",
63
66
"#### Parameters\n",
64
67
" - `bitsize`: The degree $m$ of the galois field $GF(2^m)$. Also corresponds to the number of qubits in the input register whose inverse should be calculated. \n",
65
68
"\n",
66
69
"#### Registers\n",
67
70
" - `x`: Input THRU register of size $m$ that stores elements from $GF(2^m)$.\n",
68
71
" - `result`: Output RIGHT register of size $m$ that stores $x^{-1}$ from $GF(2^m)$.\n",
69
-
" - `junk`: Output RIGHT register of size $m$ and shape ($m - 2$) that stores results from intermediate multiplications.\n"
72
+
" - `junk`: Output RIGHT register of size $m$ and shape ($m - 2$) that stores results from intermediate multiplications. \n",
73
+
"\n",
74
+
"#### References\n",
75
+
" - [Efficient quantum circuits for binary elliptic curve arithmetic: reducing T -gate complexity](https://arxiv.org/abs/1209.6348). Section 2.3\n",
76
+
" - [Structure of parallel multipliers for a class of fields GF(2^m)](https://doi.org/10.1016/0890-5401(89)90045-X)\n"
Copy file name to clipboardexpand all lines: qualtran/bloqs/gf_arithmetic/gf2_multiplication.ipynb
+5-4
Original file line number
Diff line number
Diff line change
@@ -56,12 +56,13 @@
56
56
"gates.\n",
57
57
"\n",
58
58
"#### Parameters\n",
59
-
" - `bitsize`: The degree $m$ of the galois field $GF(2^m)$. Also corresponds to the number of qubits in each of the two input registers $a$ and $b$ that should be multiplied. \n",
59
+
" - `bitsize`: The degree $m$ of the galois field $GF(2^m)$. Also corresponds to the number of qubits in each of the two input registers $a$ and $b$ that should be multiplied.\n",
60
+
" - `plus_equal_prod`: If True, implements the `PlusEqualProduct` version that applies the map $|x\\rangle |y\\rangle |z\\rangle \\rightarrow |x\\rangle |y\\rangle |x + z\\rangle$. \n",
60
61
"\n",
61
62
"#### Registers\n",
62
63
" - `x`: Input THRU register of size $m$ that stores elements from $GF(2^m)$.\n",
63
64
" - `y`: Input THRU register of size $m$ that stores elements from $GF(2^m)$.\n",
64
-
" - `result`: Output RIGHT register of size $m$ that stores the product $x * y$ in $GF(2^m)$. \n",
65
+
" - `result`: Register of size $m$ that stores the product $x * y$ in $GF(2^m)$. If plus_equal_prod is True - result is a THRU register and stores $result + x * y$. If plus_equal_prod is False - result is a RIGHT register and stores $x * y$. \n",
65
66
"\n",
66
67
"#### References\n",
67
68
" - [On the Design and Optimization of a Quantum Polynomial-Time Attack on Elliptic Curve Cryptography](https://arxiv.org/abs/0710.1093). \n",
0 commit comments