Skip to content

Semidefinite relaxation embedding ​

Module: sci_form::sdr (core since 2026-10-14; alpha::sdr re-export) Feature flag: none (core); alpha-sdr kept as no-op alias


Validation and limits ​

QuestionAnswer
Compared withCVXPY/SCS
Measured separationprojections 4.4e-16; exact embeds 7e-15; noisy case within 3× the SDP optimum
Confidence regionsmall distance sets, equilateral triangle and tetrahedron
Main limitationSDP scaling to large molecules is not benchmarked

The raw rows and the exact tolerances are in the full validation matrix.


Overview ​

Reformulates the conformer embedding problem as a convex semidefinite program (SDP), mathematically guaranteeing that the distance matrix is positive semidefinite before extracting coordinates. This eliminates the retry loop caused by negative eigenvalues in the metric matrix — the most common failure mode in distance geometry embedding.


Theory ​

Distance Constraints as Convex Set ​

The decision variable is a PSD Gram matrix X∈S+N. Distances relate to entries via:

dij2=Xii+Xjj−2Xij

Alternating Projections ​

The algorithm alternates between two convex projections:

  1. PSD Projection P+(X): Eigendecompose, zero out negative eigenvalues
  2. Distance Projection PΩ(X): Enforce Xii+Xjj−2Xij=dij2 for known pairs

Convergence criterion: ∥Xk+1−Xk∥F/∥Xk∥F<10−6

SVT (Singular Value Thresholding) ​

Optionally, a nuclear norm penalty promotes low-rank solutions:

min∥X∥∗+λ∥PΩ(X)−D∥F2

via SVTτ(X)=Umax(Σ−τ,0)VT.

Coordinate Extraction ​

From the converged Gram matrix X∗, 3D coordinates are extracted via:

C=V3Σ31/2

where V3,Σ3 are the top-3 eigenvectors/values of X∗.


API ​

rust
use sci_form::sdr::*;

// PSD projection
let (projected, n_negative) = project_psd(&matrix);

// Distance projection
let projected = project_distances(&gram, &distance_pairs);

// Alternating projections
let config = SdrConfig { max_iter: 200, tol: 1e-6, ..Default::default() };
let (result, convergence) = alternating_projections(&x0, &pairs, &config);
// convergence.iterations, convergence.converged, convergence.final_residual

// Warm start from distance matrix
let gram = warm_start_gram(n_atoms, &distance_pairs);

// Extract 3D coordinates from Gram matrix
let coords = extract_coordinates(&gram); // flat Vec<f64>

// Full SDR embedding pipeline
let result = sdr_embed(n_atoms, &distance_pairs, &config);
// result.coords: Vec<f64>
// result.num_atoms: usize
// result.convergence: SdrConvergence

Advantages Over Standard Embedding ​

IssueStandard ETKDGSDR
Negative eigenvaluesRetry loopImpossible by construction
PSD guaranteeNoYes
Failure rate~5-10%0%
Warm startNoFrom Cayley-Menger

Validation (F83, 2026-10-14) ​

External gate tests/alpha_sdr_validation.rs vs scripts/validation/oracle_sdr.py (numpy + CVXPY/SCS SDP, seed 42): PSD clip/SVT exact, distance-projection residual 4.4e-16, exact embeds 7e-15 (better than CVXPY 1e-8), noisy case within 3× of the SDP optimum. Fix: PSD dust threshold in the removal count. Run: cargo test --test alpha_sdr_validation (no feature needed).

Tests ​

bash
cargo test --features "beta-cpm alpha-sdr" --test experimental_gates -- test_sdr

8 integration tests (tests/experimental/test_sdr.rs) covering: PSD projection, negative eigenvalue removal, warm start Gram matrix, coordinate extraction with distance preservation, equilateral triangle and tetrahedron embedding, convergence tracking, and alternating projection improvement.

These tests live in the experimental_gates target — see Overview for the full command matrix.

Released under the MIT License.