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