Skip to main content

BooleanRowSpace

Struct BooleanRowSpace 

Source
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

Source

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.

Source

pub fn len(&self) -> usize

Returns the number of live rows.

Source

pub fn is_empty(&self) -> bool

Returns whether the space contains no live rows.

Source

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.

Source

pub fn rows(&self) -> impl Iterator<Item = &BooleanRow>

Iterates live rows in source order.

Source

pub fn indexed_rows(&self) -> impl Iterator<Item = (usize, &BooleanRow)>

Live rows with their stable insertion IDs, in source order.

Source

pub fn indexed_slot_count(&self) -> usize

Slots traversed by indexed_rows, including removed row IDs.

Source

pub fn row(&self, index: usize) -> Option<&BooleanRow>

A row by its stable insertion ID, or None if it has been removed.

Source

pub fn columns(&self) -> impl ExactSizeIterator<Item = usize> + '_

Possible support columns, in unspecified order.

Source

pub fn rows_with_column( &self, column: usize, ) -> impl Iterator<Item = &BooleanRow>

Rows whose active support may contain column, in source order.

Source

pub fn row_ids_with_column( &self, column: usize, ) -> impl Iterator<Item = usize> + '_

Stable IDs whose active support may contain column, in source order.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for BooleanRowSpace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BooleanRowSpace

Source§

fn default() -> BooleanRowSpace

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
where T: BorrowMut<BorrowedSelf>, BorrowedSelf: BitwiseMut + ?Sized,

§

fn assign_index(&mut self, index: usize, to: bool)

§

fn negate_index(&mut self, index: usize)

§

fn clear_bits(&mut self)

§

fn assign_random( &mut self, bit_count: usize, random_number_generator: &mut impl RngExt, )
where BorrowedSelf: BitLength,

§

impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
where Bits: BorrowMut<BorrowedSelf> + ?Sized, Other: Borrow<BorrowedOther> + ?Sized, BorrowedSelf: Bitwise + BitwisePairMut<BorrowedOther> + ?Sized, BorrowedOther: Bitwise + ?Sized,

§

fn assign(&mut self, other: &Other)

§

fn bitxor_assign(&mut self, other: &Other)

§

fn bitand_assign(&mut self, other: &Other)

§

fn bitor_assign(&mut self, other: &Other)

§

impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
where T: Borrow<BorrowedSelf> + ?Sized, Other: Borrow<BorrowedOther> + ?Sized, BorrowedSelf: Bitwise + BitwisePair<BorrowedOther> + ?Sized, BorrowedOther: Bitwise + ?Sized,

§

fn dot(&self, other: &Other) -> bool

§

fn and_weight(&self, other: &Other) -> usize

§

fn or_weight(&self, other: &Other) -> usize

§

fn xor_weight(&self, other: &Other) -> usize

§

impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
where T: Borrow<BorrowedSelf>, BorrowedSelf: Bitwise + ?Sized,

§

fn index(&self, index: usize) -> bool

§

fn weight(&self) -> usize

§

fn parity(&self) -> bool

§

fn is_zero(&self) -> bool

§

fn is_unit(&self, index: usize) -> bool

§

fn support<'a>(&'a self) -> impl SortedIterator
where BorrowedSelf: 'a,

§

fn max_support(&self) -> Option<usize>

§

fn min_support(&self) -> Option<usize>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.