Quantum Algorithm Module

Base class for quantum algorithms.

class AlgParams[source]

Bases: object

Base class for algorithm parameters.

class CryptParams(protocol: str, key_size: int)[source]

Bases: ABC

Dataclass describing the cryptographic protocol.

Parameters:
  • protocol (str) –

    Cryptographic protocol. Can be:
    • ’RSA’ (Rivest-Shamir-Adleman; factoring)

    • ’DH-SCH’ (Diffie-Hellman; discrete log over Schnorr group)

    • ’DH-SP’ (Diffie-Hellman; discrete log over safe prime group)

    • ’ECDH’ (Elliptic Curve Diffie-Hellman; discrete log over elliptic curves)

  • key_size (int) – Cryptographic key size.

key_size: int
protocol: str
class QuantumAlgorithm(crypt_params: CryptParams, alg_params: AlgParams | None = None)[source]

Bases: ABC

Abstract base class for quantum algorithms.

Initialize the quantum algorithm.

Parameters:
  • crypt_params (CryptParams) – Cryptographic parameters.

  • alg_params (Optional[AlgParams], optional) – Algorithmic parameters, by default None

estimate_resources_azure(estimator_params: EstimatorParams | None = None, alg_params: AlgParams | None = None) EstimatorResult[source]

Estimate resources using Azure Quantum Resource Estimator.

Parameters:
  • estimator_params (EstimatorParams) – Parameters for the resource estimator.

  • alg_params (Optional[AlgParams], optional) – Algorithm parameters to use for the estimation. If None, uses the parameters stored in the instance (self._alg_params).

Returns:

Results from the Azure Quantum Resource Estimator.

Return type:

EstimatorResult

estimate_resources_qualtran(cost_model: PhysicalCostModel, alg_params: AlgParams | None = None) dict[source]

Create a physical resource estimate using Qualtran.

Parameters:

cost_model (PhysicalCostModel) – Cost model used by Qualtran to estimate physical resources.

Returns:

Physical resource estimates.

Return type:

dict

static generate_search_space() list[AlgParams][source]

Generate a search space for algorithm parameters.

Returns:

List of algorithm parameters to search over.

Return type:

list[AlgParams]

abstractmethod get_algorithm_summary(alg_params: AlgParams | None = None) AlgorithmSummary[source]

Compute logical resource estimates for the circuit.

This method must be implemented by all concrete algorithm classes.

Parameters:

alg_params (Optional[AlgParams], optional) – Algorithm parameters to use for the summary. If None, uses the parameters stored in the instance (self._alg_params).

Returns:

Logical resource estimates.

Return type:

AlgorithmSummary

Raises:

ValueError – If no alg params are provided either at init or to this method.

static get_success_probability() float[source]

Get the algorithmic success probability.

Returns:

Algorithmic success probability.

Return type:

float