pub struct BlockDiagonal { /* private fields */ }Expand description
The stacked sparsity pattern for n_scenarios copies of one topology’s
Jacobian, plus the per-block recipe needed to refill it.
Implementations§
Source§impl BlockDiagonal
impl BlockDiagonal
Sourcepub fn analyze(buses: &[Bus], ybus: &YBusSparse, n_scenarios: usize) -> Self
pub fn analyze(buses: &[Bus], ybus: &YBusSparse, n_scenarios: usize) -> Self
Derives the stacked pattern by replicating a single-scenario
JacobianPattern n_scenarios times, offsetting block s’s rows
and columns by s * block_size.
All scenarios must share buses’ bus-type assignment and ybus —
that shared pattern is the entire premise. batch::Scenario cannot
override bus_type precisely so this stays true.
Sourcepub fn n_unknowns(&self) -> usize
pub fn n_unknowns(&self) -> usize
Total unknowns across the batch — n_scenarios * block_size.
Sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Unknowns per scenario.
pub fn is_empty(&self) -> bool
Sourcepub fn to_triplets(&self, values: &[f64]) -> Vec<(usize, usize, f64)>
pub fn to_triplets(&self, values: &[f64]) -> Vec<(usize, usize, f64)>
The stacked pattern as (row, col, value) triplets — the shape every
LinearSolver consumes for its one-time symbolic analysis.
Sourcepub fn fill(
&self,
states: &[Vec<Bus>],
p_calc: &[Vec<f64>],
q_calc: &[Vec<f64>],
active: &[bool],
values: &mut Vec<f64>,
)
pub fn fill( &self, states: &[Vec<Bus>], p_calc: &[Vec<f64>], q_calc: &[Vec<f64>], active: &[bool], values: &mut Vec<f64>, )
Fills the stacked value array from each scenario’s own state.
active[s] == false writes an identity block instead of scenario
s’s Jacobian (see JacobianPattern::fill_identity_into), which —
paired with a zero right-hand side — makes that scenario’s update
exactly zero while leaving the sparsity pattern untouched.
Auto Trait Implementations§
impl Freeze for BlockDiagonal
impl RefUnwindSafe for BlockDiagonal
impl Send for BlockDiagonal
impl Sync for BlockDiagonal
impl Unpin for BlockDiagonal
impl UnsafeUnpin for BlockDiagonal
impl UnwindSafe for BlockDiagonal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more