File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,14 @@ class AddConstantModN(BasicMathGate):
9090 qunum = eng.allocate_qureg(5) # 5-qubit number
9191 X | qunum[1] # qunum is now equal to 2
9292 AddConstantModN(3, 4) | qunum # qunum is now equal to 1
93+
94+ .. note::
95+
96+ Pre-conditions:
97+
98+ * c < N
99+ * c >= 0
100+ * The value stored in the quantum register must be lower than N
93101 """
94102 def __init__ (self , a , N ):
95103 """
@@ -145,6 +153,14 @@ def SubConstantModN(a, N):
145153 qunum = eng.allocate_qureg(3) # 3-qubit number
146154 X | qunum[1] # qunum is now equal to 2
147155 SubConstantModN(4,5) | qunum # qunum is now -2 = 6 = 1 (mod 5)
156+
157+ .. note::
158+
159+ Pre-conditions:
160+
161+ * c < N
162+ * c >= 0
163+ * The value stored in the quantum register must be lower than N
148164 """
149165 return AddConstantModN (N - a , N )
150166
@@ -162,6 +178,15 @@ class MultiplyByConstantModN(BasicMathGate):
162178 qunum = eng.allocate_qureg(5) # 5-qubit number
163179 X | qunum[2] # qunum is now equal to 4
164180 MultiplyByConstantModN(3,5) | qunum # qunum is now 2.
181+
182+ .. note::
183+
184+ Pre-conditions:
185+
186+ * c < N
187+ * c >= 0
188+ * gcd(c, N) == 1
189+ * The value stored in the quantum register must be lower than N
165190 """
166191 def __init__ (self , a , N ):
167192 """
You can’t perform that action at this time.
0 commit comments