pub struct BooleanRowSpace { /* private fields */ }Expand description
A sparse conditional row space with stable source order and column incidence.
Row slots stay fixed while pivots remove rows. Default methods visit only possible contributors in source order; explicit sparse variants prefer shorter rows when individual representatives may change.
Implementations§
Source§impl BooleanRowSpace
impl BooleanRowSpace
Sourcepub fn new(
rows: Vec<BooleanRow>,
diagram: &mut BooleanDecisionDiagram,
) -> Result<Self, BooleanResourceError>
pub fn new( rows: Vec<BooleanRow>, diagram: &mut BooleanDecisionDiagram, ) -> Result<Self, BooleanResourceError>
Builds an indexed row space in source order.
§Errors
Returns BooleanResourceError if indexing exceeds configured limits.
Sourcepub fn decisions_mut(&mut self) -> impl Iterator<Item = &mut DecisionId>
pub fn decisions_mut(&mut self) -> impl Iterator<Item = &mut DecisionId>
Roots for diagram collection. Only renumber the same truth functions; changing coefficients or activation here would invalidate the index.
Sourcepub fn rows(&self) -> impl Iterator<Item = &BooleanRow>
pub fn rows(&self) -> impl Iterator<Item = &BooleanRow>
Iterates live rows in source order.
Sourcepub fn indexed_rows(&self) -> impl Iterator<Item = (usize, &BooleanRow)>
pub fn indexed_rows(&self) -> impl Iterator<Item = (usize, &BooleanRow)>
Live rows with their stable insertion IDs, in source order.
Sourcepub fn indexed_slot_count(&self) -> usize
pub fn indexed_slot_count(&self) -> usize
Slots traversed by indexed_rows, including removed row IDs.
Sourcepub fn row(&self, index: usize) -> Option<&BooleanRow>
pub fn row(&self, index: usize) -> Option<&BooleanRow>
A row by its stable insertion ID, or None if it has been removed.
Sourcepub fn columns(&self) -> impl ExactSizeIterator<Item = usize> + '_
pub fn columns(&self) -> impl ExactSizeIterator<Item = usize> + '_
Possible support columns, in unspecified order.
Sourcepub fn rows_with_column(
&self,
column: usize,
) -> impl Iterator<Item = &BooleanRow>
pub fn rows_with_column( &self, column: usize, ) -> impl Iterator<Item = &BooleanRow>
Rows whose active support may contain column, in source order.
Sourcepub fn row_ids_with_column(
&self,
column: usize,
) -> impl Iterator<Item = usize> + '_
pub fn row_ids_with_column( &self, column: usize, ) -> impl Iterator<Item = usize> + '_
Stable IDs whose active support may contain column, in source order.
Sourcepub fn push(
&mut self,
row: BooleanRow,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn push( &mut self, row: BooleanRow, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Append a row after all existing rows in the pivot priority order.
§Errors
Returns BooleanResourceError if indexing exceeds configured limits.
Sourcepub fn insert_indexed(
&mut self,
row: BooleanRow,
diagram: &mut BooleanDecisionDiagram,
) -> Result<Option<usize>, BooleanResourceError>
pub fn insert_indexed( &mut self, row: BooleanRow, diagram: &mut BooleanDecisionDiagram, ) -> Result<Option<usize>, BooleanResourceError>
Append a row and return its stable ID. Inactive rows are discarded.
New insertions never reuse removed IDs; replace can restore a known ID.
§Errors
Returns BooleanResourceError if indexing exceeds configured limits.
Sourcepub fn take(
&mut self,
index: usize,
diagram: &mut BooleanDecisionDiagram,
) -> Result<Option<BooleanRow>, BooleanResourceError>
pub fn take( &mut self, index: usize, diagram: &mut BooleanDecisionDiagram, ) -> Result<Option<BooleanRow>, BooleanResourceError>
Remove a row and its postings, retaining its slot for explicit replacement.
§Errors
Returns BooleanResourceError if accounting exceeds configured limits.
Sourcepub fn replace(
&mut self,
index: usize,
row: BooleanRow,
diagram: &mut BooleanDecisionDiagram,
) -> Result<Option<BooleanRow>, BooleanResourceError>
pub fn replace( &mut self, index: usize, row: BooleanRow, diagram: &mut BooleanDecisionDiagram, ) -> Result<Option<BooleanRow>, BooleanResourceError>
Replace an existing slot without changing its pivot priority or ID. An inactive replacement removes the row. Returns the displaced row.
§Panics
Panics if index was never returned by insert_indexed in this space.
§Errors
Returns BooleanResourceError if accounting exceeds configured limits.
Sourcepub fn erase_column(
&mut self,
column: usize,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn erase_column( &mut self, column: usize, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Erase a column from every indexed row without changing activation. After unconditional elimination, off-activation coefficients may remain unindexed; this guarantees removal from active support. Spaces maintained by insertion, replacement, and reduction retain full raw postings.
§Errors
Returns BooleanResourceError if accounting exceeds configured limits.
§Panics
Panics if the internal row-to-column index is inconsistent.
Sourcepub fn into_rows(
self,
diagram: &mut BooleanDecisionDiagram,
) -> Result<Vec<BooleanRow>, BooleanResourceError>
pub fn into_rows( self, diagram: &mut BooleanDecisionDiagram, ) -> Result<Vec<BooleanRow>, BooleanResourceError>
Consumes the space and returns its live rows in source order.
§Errors
Returns BooleanResourceError if accounting exceeds configured limits.
Sourcepub fn eliminate_column(
&mut self,
column: usize,
diagram: &mut BooleanDecisionDiagram,
) -> Result<BooleanRow, BooleanResourceError>
pub fn eliminate_column( &mut self, column: usize, diagram: &mut BooleanDecisionDiagram, ) -> Result<BooleanRow, BooleanResourceError>
Eliminate one column pointwise, choosing the first available row on each guard. The returned pivot carries every auxiliary witness coordinate.
§Errors
Returns BooleanResourceError if elimination exceeds configured limits.
Sourcepub fn eliminate_column_sparse(
&mut self,
column: usize,
diagram: &mut BooleanDecisionDiagram,
) -> Result<BooleanRow, BooleanResourceError>
pub fn eliminate_column_sparse( &mut self, column: usize, diagram: &mut BooleanDecisionDiagram, ) -> Result<BooleanRow, BooleanResourceError>
Eliminate one column using shortest-support pivots, with source order breaking ties. Preserves the conditional row space, not its representatives.
§Errors
Returns BooleanResourceError if elimination exceeds configured limits.
Sourcepub fn eliminate_column_when(
&mut self,
column: usize,
gate: DecisionId,
diagram: &mut BooleanDecisionDiagram,
) -> Result<BooleanRow, BooleanResourceError>
pub fn eliminate_column_when( &mut self, column: usize, gate: DecisionId, diagram: &mut BooleanDecisionDiagram, ) -> Result<BooleanRow, BooleanResourceError>
Eliminate gate & coefficient, retaining the column outside the gate.
§Errors
Returns BooleanResourceError if elimination exceeds configured limits.
Sourcepub fn eliminate_column_when_sparse(
&mut self,
column: usize,
gate: DecisionId,
diagram: &mut BooleanDecisionDiagram,
) -> Result<BooleanRow, BooleanResourceError>
pub fn eliminate_column_when_sparse( &mut self, column: usize, gate: DecisionId, diagram: &mut BooleanDecisionDiagram, ) -> Result<BooleanRow, BooleanResourceError>
Guarded column elimination with shortest-support pivots. Individual representatives may change; support outside the gate remains available.
§Errors
Returns BooleanResourceError if elimination exceeds configured limits.
Sourcepub fn eliminate_linear(
&mut self,
terms: &[(usize, DecisionId)],
diagram: &mut BooleanDecisionDiagram,
) -> Result<BooleanRow, BooleanResourceError>
pub fn eliminate_linear( &mut self, terms: &[(usize, DecisionId)], diagram: &mut BooleanDecisionDiagram, ) -> Result<BooleanRow, BooleanResourceError>
Eliminate an ordered XOR of weighted column coefficients. Repeated columns retain every occurrence; columns themselves need not become zero.
§Errors
Returns BooleanResourceError if elimination exceeds configured limits.
Sourcepub fn reduce_column(
&mut self,
column: usize,
pivot: &BooleanRow,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn reduce_column( &mut self, column: usize, pivot: &BooleanRow, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Reduce only rows that may carry this pivot column. Unlike elimination, this preserves their activation and retains their other pivot choices.
§Errors
Returns BooleanResourceError if reduction exceeds configured limits.
§Panics
Panics if the internal row-to-column index is inconsistent.
Sourcepub fn reduce_linear(
&mut self,
terms: &[(usize, DecisionId)],
pivot: &BooleanRow,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn reduce_linear( &mut self, terms: &[(usize, DecisionId)], pivot: &BooleanRow, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Reduce an ordered XOR of weighted columns against a supplied pivot. The pivot must have unit projection on its activation.
§Errors
Returns BooleanResourceError if reduction exceeds configured limits.
§Panics
Panics if the internal row-to-column index is inconsistent.