pyqpanda_alg.QLuoShu.q_elliptic_pdou
¶
Module Contents¶
Functions¶
|
Quantum Circuit for Point Addition of Elliptic Curves over Prime Field (\(p>2\)). |
- pyqpanda_alg.QLuoShu.q_elliptic_pdou.q_elliptic_pdou(p, a, b, P)¶
Quantum Circuit for Point Addition of Elliptic Curves over Prime Field (\(p>2\)).
- Parameters:
\(p\):
int
represents the character of prime field \(\mathbb{F}_{p}\)
\(a,b\) :
int
represent an elliptic curve \(E/\mathbb{F}_{p}: y^{2}=x^{3}+ax+b\)
\(P\):
vector
represents a point on the elliptic curve \(E/\mathbb{F}_{p}\)
- Return:
The quantum states of the \(x-\) coordinate and \(y-\) coordinate of \([2]P\).
The function is used to compute point addition \(P+Q\) with \(P \neq Q\) on elliptic curves \(y^{2}=x^{3}+ax+b\) over finite field \(\mathbb{F}_{p}\) (\(p>2\)). The circuit of point doubling is constructed by some variant modulo arithmetic and based on classical addition formulas.
- Example:
If \(E/\mathbb{F}_{11}: y^{2}=x^{3}+7x+9\), \(P =(5,2)\), by the function, we can get the quantum state of \([2]P\), which is \(|0110 \rangle|0101 \rangle\). So, \([2]P=(6,5)\).
from pyqpanda import * import math from pyqpanda_alg.QLuoShu import q_elliptic_pdou if __name__ == "__main__": p = 11 a = 7 b = 9 P = [5, 2] q_elliptic_pdou.q_elliptic_pdou(p, a, b, P)
The function above would give results:
The elliptic curve:y^{2}=x^{3}+7x+9 P=(5,2) 0110 :1.0000000000000255 0101 :1.0000000000000255 2P=(6,5)