pub struct ResolvedLoadFactors { /* private fields */ }Expand description
Pre-resolved per-block load scaling factors.
Provides O(1) lookup of load block factors by (bus_index, stage_index, block_index). Returns 1.0 for absent entries (no scaling). Populated
by cobre-io during the resolution step and stored in crate::System.
Uses dense 3D storage (n_buses * n_stages * max_blocks) initialized to
1.0. The total size is small (typically < 10K entries) and the lookup is
on the LP-building hot path.
§Examples
use cobre_core::resolved::ResolvedLoadFactors;
let empty = ResolvedLoadFactors::empty();
assert!((empty.factor(0, 0, 0) - 1.0).abs() < f64::EPSILON);Implementations§
Source§impl ResolvedLoadFactors
impl ResolvedLoadFactors
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create an empty load factors table. All lookups return 1.0.
Used as the default when no load_factors.json exists.
§Examples
use cobre_core::resolved::ResolvedLoadFactors;
let t = ResolvedLoadFactors::empty();
assert!((t.factor(5, 3, 2) - 1.0).abs() < f64::EPSILON);Sourcepub fn new(n_buses: usize, n_stages: usize, max_blocks: usize) -> Self
pub fn new(n_buses: usize, n_stages: usize, max_blocks: usize) -> Self
Create a new load factors table with the given dimensions.
All entries are initialized to 1.0 (no scaling). Use set to
populate individual entries.
Trait Implementations§
Source§impl Clone for ResolvedLoadFactors
impl Clone for ResolvedLoadFactors
Source§fn clone(&self) -> ResolvedLoadFactors
fn clone(&self) -> ResolvedLoadFactors
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedLoadFactors
impl Debug for ResolvedLoadFactors
Source§impl PartialEq for ResolvedLoadFactors
impl PartialEq for ResolvedLoadFactors
impl StructuralPartialEq for ResolvedLoadFactors
Auto Trait Implementations§
impl Freeze for ResolvedLoadFactors
impl RefUnwindSafe for ResolvedLoadFactors
impl Send for ResolvedLoadFactors
impl Sync for ResolvedLoadFactors
impl Unpin for ResolvedLoadFactors
impl UnsafeUnpin for ResolvedLoadFactors
impl UnwindSafe for ResolvedLoadFactors
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
Mutably borrows from an owned value. Read more