Skip to main content

Module matrix

Module matrix 

Source
Expand description

Sparse matrix builders for MATPOWER cases.

Sign convention: the susceptance matrix has the form B = A diag(b) Aᵀ with the node-by-edge incidence A (n×m) and per-edge weight b_e = x/(r²+x²) (see bprime.rs for the entry-level form). Resulting matrices satisfy positive diagonal, negative off-diagonal, diag = sum of |off-diagonal| — the positive (M-matrix) Laplacian form SDDM solvers expect.

Re-exports§

pub use incidence::DcConvention;
pub use incidence::IncidenceParts;
pub use incidence::build_flow_map;
pub use incidence::build_incidence;
pub use incidence::susceptance_diag;
pub use laplacian::GroundedIndexMap;
pub use laplacian::build_weighted_laplacian;
pub use laplacian::ground_at;
pub use laplacian::ground_at_each;
pub use laplacian::reference_indicator;
pub use laplacian::unit_vector;
pub use opf::BusCosts;
pub use opf::GenCosts;
pub use opf::OpfInstance;
pub use opf::Units;
pub use opf::build_opf_instance;
pub use sensitivity::build_lodf;
pub use sensitivity::build_ptdf;
pub use sensitivity::build_ptdf_lodf;

Modules§

incidence
DC network primitives: the signed incidence matrix A, branch susceptances b, the flow map B Aᵀ, and the phase shift injection.
kkt
Interior point operator assembly for the DC-OPF Newton step.
laplacian
The weighted Laplacian L = A diag(w) Aᵀ, reference grounding, and the index bookkeeping for mapping a grounded solve back to full size.
opf
DC-OPF instance data derived from the network’s generators and their cost curves: cost, bounds, thermal limits, the generator→bus map, and nodal load.
sensitivity
DC sensitivity matrices.
triplet
CooBuilder — a small HashMap backed coordinate format accumulator. Deduplicates (i, j) entries on insert (each add is O(1) amortized, independent of nnz). Replaces the previous Vec linear scan accumulator, which was O(nnz²) per case.

Structs§

BuildOptions
MatrixStats
Common stats over a sparse matrix used by the TUI and meta.json.
YbusParts
Re(Y_bus) and Im(Y_bus) as separate CSR matrices.

Enums§

Scheme
Which FDPF scheme to use for B’.

Functions§

build_adjacency
Build the n × n 0/1 adjacency matrix.
build_bdoubleprime
build_bprime
build_lacpf
build_ybus
sddm_check
Whether a matrix is SDDM (symmetric diagonally dominant M-matrix). Useful as a quick sanity check before feeding it to an SDDM solver.