(enhanced-period-finding a N n-qubits)
(enhanced-period-finding a N n-qubits n-measurements)
Quantum subroutine for finding the period of f(x) = a^x mod N.
This is the quantum heart of Shor's algorithm. It uses quantum phase estimation with the QFT to find the period r such that a^r ≡ 1 (mod N).
Parameters:
Returns: Map containing:
Quantum subroutine for finding the period of f(x) = a^x mod N. This is the quantum heart of Shor's algorithm. It uses quantum phase estimation with the QFT to find the period r such that a^r ≡ 1 (mod N). Parameters: - a: Base for the function f(x) = a^x mod N - N: Modulus - n-qubits: Number of qubits for the quantum register (should be ~2*log₂(N)) - hardware-compatible: (optional) Use hardware-compatible implementation - n-measurements: (optional) Number of measurements to perform for statistical analysis Returns: Map containing: - :measured-values - List of measured values from quantum circuit executions - :estimated-period - Estimated period based on continued fractions - :circuit - The quantum circuit used - :success - Whether a valid period was found - :confidence - Statistical confidence in the result (only with multiple measurements)
(quantum-period-finding measured-value precision N a)
Find the period from a phase estimate using improved continued fraction expansion.
This function implements a more robust version of period extraction from a phase measurement, which is critical for Shor's algorithm.
Parameters:
Returns: Most likely period or nil if no valid period found
Find the period from a phase estimate using improved continued fraction expansion. This function implements a more robust version of period extraction from a phase measurement, which is critical for Shor's algorithm. Parameters: - measured-value: The value from quantum measurement - precision: Number of bits used in phase estimation - N: Modulus for period finding - a: Base for modular exponentiation Returns: Most likely period or nil if no valid period found
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close