Skip to content
Pasqal Documentation

qoolqit.embedding.algorithms

package
qoolqit.embedding.algorithms

Classes

Functions

dataclass
InteractionEmbeddingConfig (method: str = 'Nelder-Mead', maxiter: int = 200000, tol: float = 1e-08)

Bases : EmbeddingConfig

Configuration parameters for the interaction embedding.

interaction_embedding (matrix: np.ndarray, method: str, maxiter: int, tol: float) → np.ndarray

Matrix embedding into the interaction term of the Rydberg Analog Model.

Uses scipy.minimize to find the optimal set of node coordinates such that the matrix of values 1/(r_ij)^6 approximate the off-diagonal terms of the input matrix.

Check scipy.minimize documentation for more information on each parameter.

Parameters

  • matrix : np.ndarray the matrix to embed.

  • method : str the method used by scipy.minimize.

  • maxiter : int maximum number of iterations.

  • tol : float tolerance for termination.

dataclass
SpringLayoutConfig (k: float | None = None, iterations: int = 50, threshold: float = 0.0001, seed: int | None = None)

Bases : EmbeddingConfig

Configuration parameters for the spring-layout embedding.

spring_layout_embedding (graph: DataGraph, k: float | None, iterations: int, threshold: float, seed: int | None) → DataGraph

Force-directed embedding, wrapping nx.spring_layout.

Generates a graph with the same nodes and edges as the original graph, but with node coordinates set to be the positions given by nx.spring_layout.

Check the documentation for nx.spring_layout for more information on each parameter.

Parameters

  • graph : DataGraph the graph to embed.

  • k : float | None optimal distance between nodes.

  • iterations : int maximum number of iterations to take.

  • threshold : float threshold value for relative error in node position changes.

  • sed random seed.