BEAModMultiplier
QuICT.algorithm.arithmetic.multiplier.bea_mod_multiplier.BEAMulMod ¶
BEAMulMod(qreg_size: int, multiplicand: int, modulus: int, control: bool = True, in_fourier: bool = False, out_fourier: bool = False, name: str = None)
Bases: CompositeGate
Use FourierModAdder to calculate (b+ax)%N in Fourier space that in total requires 2n + 3 qubits.
References
[1]: "Circuit for Shor's algorithm using 2n+3 qubits" by Stephane Beauregard http://arxiv.org/abs/quant-ph/0205095v3.
Parameters:
-
qreg_size(int) –The quantum register size for the multiplier encoded in qubit.
-
multiplicand(int) –The value for the multiplicand which is given classically.
-
modulus(int) –The integer given as modulus.
-
control(bool, default:True) –Whether having qubit to control the modular multiplier. If true, the control qubit will be on the highest qubit.
-
in_fourier(bool, default:False) –If True, assuming the input register is already in Fourier spacec.
-
out_fourier(bool, default:False) –If True, after the addition, the qreg will be left in Fourier spacec.
-
name(str, default:None) –Name of the wired adder gate.
Raises:
GateParametersAssignedError: If qreg_size is smaller than 1.
Source code in QuICT/algorithm/arithmetic/multiplier/bea_mod_multiplier.py
QuICT.algorithm.arithmetic.multiplier.bea_mod_multiplier.BEACUa ¶
Bases: CompositeGate
Modular multiplication circuit for Shor's algorithm using 2n+3 qubits
http://arxiv.org/abs/quant-ph/0205095v3
For reg_size is n:
|control>|x>{n}|0> --> |control>|a*x mod N>{n}|0> , control == 1 |control>|x>{n}|0> --> |control>|x>{n}|0> , control == 0
Construct the modular multiplication gate
Parameters:
-
modulus(int) –the modulus in the modular multiplication.
-
multiple(int) –the multiple in the modular multiplication.
-
qreg_size(int) –size of the register to hold the result of the modular multiplication.
-
name(str, default:None) –name of the gate.