pub struct BooleanRow {
pub active: DecisionId,
/* private fields */
}Expand description
A sparse GF(2) row whose entries and availability are Boolean functions. Extra columns can carry witnesses through exactly the same row operations.
Fields§
§active: DecisionIdDecision under which this row is available.
Implementations§
Source§impl BooleanRow
impl BooleanRow
Sourcepub fn probe_coefficients(
&self,
columns: &[usize],
diagram: &mut BooleanDecisionDiagram,
) -> Result<Vec<DecisionId>, BooleanResourceError>
pub fn probe_coefficients( &self, columns: &[usize], diagram: &mut BooleanDecisionDiagram, ) -> Result<Vec<DecisionId>, BooleanResourceError>
Query raw coefficients without expanding a deferred row. Results retain request order and duplicates, with zero for absent columns. Activation does not mask the values, including values outside the reachable domain. The row and its composed witness remain unchanged.
Returned decisions belong to diagram; retain them as roots if collecting
before consuming them. No query cache or per-row expanded image is kept.
§Errors
Returns BooleanResourceError if querying exceeds cumulative work limits.
§Panics
Panics if a deferred row has no active witness tape.
Sourcepub fn defer_coefficients(
&mut self,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn defer_coefficients( &mut self, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Move coefficients outside the tape’s common explicit partition into an immutable witness leaf. This preserves the raw off-activation values. A fresh core allocation releases the former full-support capacity.
§Errors
Returns BooleanResourceError if recording the witness exceeds configured limits.
§Panics
Panics if the row is already deferred or no witness tape is active.
Sourcepub fn expand_coefficients(
&mut self,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn expand_coefficients( &mut self, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
Restore every deferred coefficient before full-support iteration,
mapping, or physical binding. No intermediate witness rows are expanded;
use Self::probe_coefficients to query a subset without changing the row.
§Errors
Returns BooleanResourceError if reconstruction exceeds configured limits.
§Panics
Panics if a deferred row has no active witness tape.
Source§impl BooleanRow
impl BooleanRow
Sourcepub fn new(active: DecisionId) -> Self
pub fn new(active: DecisionId) -> Self
Creates an empty row available under active.
Sourcepub fn from_terms(
active: DecisionId,
terms: impl IntoIterator<Item = (usize, DecisionId)>,
) -> Self
pub fn from_terms( active: DecisionId, terms: impl IntoIterator<Item = (usize, DecisionId)>, ) -> Self
Build a row; repeated columns keep their last value, like set.
Sourcepub fn terms(&self) -> &[(usize, DecisionId)]
pub fn terms(&self) -> &[(usize, DecisionId)]
Explicit nonzero coefficients in strictly increasing column order.
Deferred witness coefficients are restored by expand_coefficients.
Sourcepub fn into_terms(self) -> Vec<(usize, DecisionId)>
pub fn into_terms(self) -> Vec<(usize, DecisionId)>
Consumes the row and returns its explicit coefficients.
§Panics
Panics if deferred coefficients have not been expanded.
Sourcepub fn map_coefficients(
&mut self,
map: impl FnMut(DecisionId) -> Result<DecisionId, BooleanResourceError>,
) -> Result<(), BooleanResourceError>
pub fn map_coefficients( &mut self, map: impl FnMut(DecisionId) -> Result<DecisionId, BooleanResourceError>, ) -> Result<(), BooleanResourceError>
Replace coefficients and remove terms that become zero.
§Errors
Returns the first BooleanResourceError produced by map.
§Panics
Panics if deferred coefficients have not been expanded.
Sourcepub fn truncate_columns(&mut self, end: usize)
pub fn truncate_columns(&mut self, end: usize)
Discard auxiliary columns at and above end.
§Panics
Panics if deferred coefficients have not been expanded.
Sourcepub fn decisions_mut(&mut self) -> impl Iterator<Item = &mut DecisionId>
pub fn decisions_mut(&mut self) -> impl Iterator<Item = &mut DecisionId>
Every decision owned by this row, for arena lifetime management.
Sourcepub fn get(&self, column: usize) -> DecisionId
pub fn get(&self, column: usize) -> DecisionId
Query an explicit coefficient; deferred columns must not be constraints.
Sourcepub fn set(&mut self, column: usize, value: DecisionId)
pub fn set(&mut self, column: usize, value: DecisionId)
Sets one explicit coefficient, removing it when value is false.
§Panics
Panics if the row has deferred coefficients.
Sourcepub fn xor_scaled(
&mut self,
other: &Self,
factor: DecisionId,
diagram: &mut BooleanDecisionDiagram,
) -> Result<(), BooleanResourceError>
pub fn xor_scaled( &mut self, other: &Self, factor: DecisionId, diagram: &mut BooleanDecisionDiagram, ) -> Result<(), BooleanResourceError>
XORs other into this row under the Boolean factor.
§Errors
Returns BooleanResourceError if row algebra exceeds configured limits.
§Panics
Panics if explicit coefficients are mixed with deferred witness rows.
Trait Implementations§
Source§impl Clone for BooleanRow
impl Clone for BooleanRow
Source§fn clone(&self) -> BooleanRow
fn clone(&self) -> BooleanRow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more