mqt.bench.benchmarks.shor¶
Shor benchmark definition.
Module Contents¶
- create_circuit(circuit_size: int) QuantumCircuit[source]¶
Construct Shor’s circuit based on total qubit count.
- Parameters:
circuit_size – Must be one of 18, 42, 58, 74.
- Returns:
QuantumCircuit implementing Shor’s algorithm for the chosen size.
- Raises:
ValueError – if the size is not available.
- create_circuit_from_num_and_coprime(num_to_be_factorized: int, a: int = 2) QuantumCircuit[source]¶
Returns a quantum circuit implementing the Shor’s algorithm.
- Parameters:
num_to_be_factorized – number which shall be factorized
a – any integer that satisfies 1 < a < num_to_be_factorized and gcd(a, num_to_be_factorized) = 1
- get_instance(choice: str) list[int][source]¶
Returns the number to be factorized and the integer a for the Shor’s algorithm.
- class Shor[source]¶
Shor’s algorithm implementation.
- construct_circuit(to_be_factored_number: int, a: int = 2) QuantumCircuit[source]¶
Construct quantum part of the algorithm.
- Parameters:
to_be_factored_number – The odd integer to be factored, has a min. value of 3.
a – Any integer that satisfies 1 < a < N and gcd(a, N) = 1.
- Returns:
Quantum circuit.