pub struct Xgcf {
pub node_type: Vec<XgcfNodeType>,
pub child_offsets: Vec<u32>,
pub child_indices: Vec<u32>,
pub lit: Vec<i32>,
pub decision_var: Vec<u32>,
pub decision_child_false: Vec<u32>,
pub decision_child_true: Vec<u32>,
pub roots: Vec<u32>,
pub level_offsets: Vec<u32>,
pub level_nodes: Vec<u32>,
}Expand description
Host-side structure-of-arrays representation of a compiled probabilistic circuit.
Fields§
§node_type: Vec<XgcfNodeType>Opcode for every node.
child_offsets: Vec<u32>CSR offsets into Self::child_indices for each node.
child_indices: Vec<u32>Flattened children of conjunction and disjunction nodes.
lit: Vec<i32>Signed DIMACS literal for each literal node, or zero otherwise.
decision_var: Vec<u32>Decision variable for each decision node, or zero otherwise.
decision_child_false: Vec<u32>False-branch child for each decision node.
decision_child_true: Vec<u32>True-branch child for each decision node.
roots: Vec<u32>Circuit root node indices.
level_offsets: Vec<u32>CSR offsets into Self::level_nodes for bottom-up evaluation levels.
level_nodes: Vec<u32>Node indices ordered by bottom-up evaluation level.
Implementations§
Source§impl Xgcf
impl Xgcf
Sourcepub fn from_ddnnf(ddnnf: &DecisionDnnf) -> Result<Self>
pub fn from_ddnnf(ddnnf: &DecisionDnnf) -> Result<Self>
Converts a decision-DNNF circuit into XGCF and validates its topology.
Sourcepub fn smooth_random_vars(&self, is_random_var: &[bool]) -> Result<Self>
pub fn smooth_random_vars(&self, is_random_var: &[bool]) -> Result<Self>
Return a semantically equivalent circuit that is smooth with respect to
the subset of variables marked as random in is_random_var.
Smoothness guarantees that, for any OR/DECISION node, all branches mention the same set of random variables. This makes WMC evaluation and gradients correct even when evidence/queries force random variables in non-smooth Decision-DNNF outputs.
Sourcepub fn eval_log_wmc<F>(&self, var_log_weights: F) -> Result<f64>
pub fn eval_log_wmc<F>(&self, var_log_weights: F) -> Result<f64>
Evaluates the circuit’s weighted model count in log space on the CPU.