-
BladeConfig — Configuration parameters to embed with BLaDE.
-
InteractionEmbeddingConfig — Configuration parameters for the interaction embedding.
-
SpringLayoutConfig — Configuration parameters for the spring-layout embedding.
qoolqit.embedding.algorithms
package
qoolqit.embedding.algorithms
Classes
Functions
-
interaction_embedding — Matrix embedding into the interaction term of the Rydberg Analog Model.
-
spring_layout_embedding — Force-directed embedding, wrapping
nx.spring_layout.
Modules
dataclass
BladeConfig
(max_min_dist_ratio: float | None = None, dimensions: tuple[int, ...] = (5, 4, 3, 2, 2, 2), starting_positions: np.ndarray | None = None, pca: bool = False, steps_per_round: int = 200, compute_weight_relative_threshold: Callable[[float],
float] = lambda _:
0.1, compute_max_distance_to_walk: Callable[[float, float
| None], float | tuple[float, float, float]] = lambda x, max_radial_dist: np.inf, starting_ratio_factor: int = 2, draw_steps: bool |
list[int] = False, device:
InitVar[Device | None] =
None)
Bases : EmbeddingConfig
Configuration parameters to embed with BLaDE.
module
blade
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 the documentation for scipy.minimize for more information about 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
(iterations: int = 100, threshold: float = 0.0001, seed: int |
None = None)
Bases : EmbeddingConfig
Configuration parameters for the spring-layout embedding.
spring_layout_embedding (graph: DataGraph, iterations: int, threshold: float, seed: int | None) → DataGraph
Force-directed embedding, wrapping nx.spring_layout.
Generates a new graph with the same nodes and edges as the original graph, but with node coordinates set to embed edge weights into pairwise distances as wᵢⱼ=1/rᵢⱼ^6.
The positions are generated by nx.spring_layout.
Since nx.spring_layout embeds edge
weights as wᵢⱼ = (k/rᵢⱼ)^3, we set:
- k=1 and scale=None to disable global rescaling of positions.
- rescale weights wᵢⱼ -> wᵢⱼ^1/2
to achieve our target embedding wᵢⱼ=1/rᵢⱼ^6.
Check the documentation for `nx.spring_layout` for more information about each parameter
Parameters
-
graph : DataGraph — the graph to embed according to its edge weights.
-
iterations : int — maximum number of iterations to take.
-
threshold : float — Threshold for relative error in node position changes. The iteration stops if force-displacement is below this threshold.
-
seed : int | None — random seed for reproducibility.
Returns
-
DataGraph — graph with the node coordinates set according to the spring-layout embedding.
