← Documentation
ADS-IDAC Engine 5.0.0
bncore::BatchWorkspace Class Reference

Message passing state for one junction tree and one batch size. More...

#include <workspace.hpp>

Collaboration diagram for bncore::BatchWorkspace:
[legend]

Public Member Functions

 BatchWorkspace (const JunctionTree &jt, std::size_t batch_size=1)
 Builds the workspace and calibrates it without evidence. More...
 
void reset (std::size_t new_batch_size, std::size_t cpt_batch_offset=0)
 Prepares the workspace for a new evidence case. More...
 
void set_evidence_matrix (const int *evidence_matrix, std::size_t num_vars)
 Sets the hard evidence for the next calibration. More...
 
void clear_evidence ()
 Forgets the hard evidence matrix. Soft evidence is not affected. More...
 
void set_soft_evidence (NodeId var, const double *likelihoods, std::size_t n_states)
 Sets one likelihood vector for a variable, shared by all batch rows. More...
 
void set_soft_evidence_matrix (NodeId var, const double *likelihoods_matrix, std::size_t n_states)
 Sets a separate likelihood vector per batch row for a variable. More...
 
void clear_soft_evidence ()
 Removes all soft evidence, scalar and matrix. More...
 
void calibrate ()
 Runs sum-product message passing with the current evidence. More...
 
void max_calibrate ()
 Runs max-product propagation with the current evidence, for query_map(). More...
 
void query_map (int *out_states, std::size_t n_vars) const
 Decodes a state for each variable from the max-product beliefs. More...
 
DenseTensor query_marginal (NodeId node) const
 Marginal of one variable from the last calibrate(). More...
 
void query_marginals_multi (const NodeId *query_vars, std::size_t num_queries, const std::size_t *offsets, double *out) const
 Marginals of several variables from the last calibrate(), with one scan of each clique involved. More...
 

Private Member Functions

void rebuild_clique_potentials (std::size_t target_batch_size)
 
void resize_runtime_buffers (std::size_t target_batch_size)
 Sizes message, belief and scratch buffers for a batch size. More...
 
void snapshot_base_potentials ()
 Copies clique_potentials_ into owning base_clique_potentials_. More...
 
void build_node_to_clique_map ()
 
void build_message_schedule ()
 Fills collect_ops_, distribute_ops_, assemble_ops_ and clique_marg_info_. More...
 
bool apply_soft_evidence_to_clique (std::size_t ci)
 

Private Attributes

const JunctionTree & jt_
 
std::size_t batch_size_
 
std::size_t cpt_batch_offset_ = 0
 
std::vector< Factor > clique_potentials_
 
std::vector< Factor > base_clique_potentials_
 
std::size_t base_batch_size_ = 0
 
std::size_t base_batch_offset_ = 0
 
bool base_depends_on_offset_ = false
 
const int * evidence_matrix_ = nullptr
 
std::size_t evidence_num_vars_ = 0
 
std::unordered_map< NodeId, std::vector< double > > soft_evidence_scalar_
 
std::unordered_map< NodeId, std::vector< double > > soft_evidence_matrix_
 
std::size_t root_clique_
 
std::vector< std::size_t > collect_order_
 
std::vector< std::size_t > distribute_order_
 
std::vector< std::size_t > parent_of_
 
std::vector< std::vector< std::size_t > > children_of_
 
std::vector< std::vector< double > > up_msg_buf_
 
std::vector< std::vector< double > > down_msg_buf_
 
std::vector< std::size_t > up_msg_size_
 
std::vector< std::size_t > down_msg_size_
 
std::vector< std::size_t > sepset_size_
 
std::vector< std::size_t > clique_states_
 
std::vector< CollectOp > collect_ops_
 
std::vector< DistributeOp > distribute_ops_
 
std::vector< AssembleOp > assemble_ops_
 
std::vector< double > scratch_buf_
 
std::size_t max_product_states_ = 0
 
std::vector< uint8_t > ev_clique_
 
std::vector< uint8_t > up_changed_
 
std::vector< uint8_t > down_changed_
 
std::vector< uint8_t > cal_changed_
 
std::vector< std::vector< double > > cal_pot_buf_
 
std::vector< std::size_t > cal_pot_size_
 
std::vector< std::vector< double > > map_up_msg_buf_
 
std::vector< std::vector< uint32_t > > map_traceback_
 
std::vector< std::vector< double > > map_cal_pot_buf_
 
std::vector< std::vector< double > > base_up_buf_
 
std::vector< std::vector< double > > base_down_buf_
 
std::vector< std::vector< double > > base_cal_buf_
 
bool is_first_calibration_ = true
 
std::vector< CliqueMargInfo > clique_marg_info_
 
std::vector< std::vector< double > > ev_scratch_
 
std::vector< bool > ev_scratch_active_
 
std::unordered_map< NodeId, std::size_t > node_to_clique_
 
std::unordered_map< NodeId, std::vector< std::size_t > > node_in_cliques_
 
std::vector< uint8_t > query_visited_scratch_
 

Detailed Description

Message passing state for one junction tree and one batch size.

A workspace evaluates batch_size independent evidence rows at once. Every clique potential, message and belief carries a trailing batch dimension, stored as index * batch_size + row.

Construction orients the junction tree (each connected part is rooted at its lowest clique index), builds the index tables for every message, builds the clique potentials from the graph's CPTs, and runs one calibration without evidence. The messages and beliefs of that calibration are kept. Later calibrations recompute only the messages that evidence can change and copy the rest from the kept values.

Order of use for one evidence case: reset(), then the evidence setters, then calibrate() or max_calibrate(), then the query functions. calibrate() applies evidence to the current clique potentials and does not undo evidence applied by an earlier calibrate(), so reset() is required between evidence cases.

The workspace keeps a reference to the junction tree and reads the graph through it. Both must outlive the workspace. A workspace is not synchronized: use one per thread.

Definition at line 110 of file workspace.hpp.

Constructor & Destructor Documentation

◆ BatchWorkspace()

bncore::BatchWorkspace::BatchWorkspace ( const JunctionTree &  jt,
std::size_t  batch_size = 1 
)
explicit

Builds the workspace and calibrates it without evidence.

For a variable whose CPT is batched (see Graph::set_cpt()), the CPT batch size must be 1, or equal batch_size, or be larger than batch_size. In the last case reset() selects which rows are used.

Parameters
jtCompiled junction tree. Held by reference.
batch_sizeNumber of evidence rows evaluated together. Must be greater than 0.
Exceptions
std::invalid_argumentif batch_size is 0, a variable's CPT is empty, a CPT size is not a multiple of its family size, or a batched CPT does not fit batch_size.

Definition at line 89 of file workspace.cpp.

References batch_size_, build_message_schedule(), build_node_to_clique_map(), children_of_, bncore::JunctionTree::cliques(), collect_order_, distribute_order_, jt_, parent_of_, rebuild_clique_potentials(), and root_clique_.

Here is the call graph for this function:

Member Function Documentation

◆ apply_soft_evidence_to_clique()

bool bncore::BatchWorkspace::apply_soft_evidence_to_clique ( std::size_t  ci)
private

Definition at line 573 of file workspace.cpp.

References batch_size_, clique_marg_info_, clique_potentials_, clique_states_, bncore::DenseTensor::data(), ev_clique_, ev_scratch_, ev_scratch_active_, evidence_matrix_, evidence_num_vars_, bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, bncore::VariableMetadata::name, bncore::Factor::scope(), bncore::DenseTensor::shape(), soft_evidence_matrix_, soft_evidence_scalar_, bncore::CliqueMargInfo::state_of_dim, and bncore::Factor::tensor().

Referenced by calibrate(), and max_calibrate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_message_schedule()

void bncore::BatchWorkspace::build_message_schedule ( )
private

Fills collect_ops_, distribute_ops_, assemble_ops_ and clique_marg_info_.

Definition at line 141 of file workspace.cpp.

References assemble_ops_, base_cal_buf_, base_down_buf_, base_up_buf_, batch_size_, bncore::build_marg_map_u32(), bncore::build_pot_map_u32(), cal_changed_, cal_pot_buf_, cal_pot_size_, bncore::CollectOp::child_cliques, bncore::AssembleOp::child_cliques, bncore::CollectOp::child_maps, bncore::AssembleOp::child_maps, children_of_, clique_marg_info_, clique_states_, bncore::JunctionTree::cliques(), collect_ops_, collect_order_, bncore::combine_scopes(), distribute_ops_, distribute_order_, down_changed_, bncore::DistributeOp::down_map, bncore::AssembleOp::down_map, down_msg_buf_, down_msg_size_, ev_clique_, ev_scratch_, ev_scratch_active_, bncore::Graph::get_variable(), bncore::JunctionTree::graph(), bncore::AssembleOp::has_down, bncore::DistributeOp::has_parent_down, jt_, bncore::make_strides(), bncore::CollectOp::marg_map, bncore::DistributeOp::marg_map, max_product_states_, bncore::CliqueMargInfo::n_states_total, bncore::DistributeOp::parent_clique, parent_of_, bncore::CollectOp::pot_map, bncore::DistributeOp::pot_map, bncore::CollectOp::product_states, bncore::DistributeOp::product_states, bncore::AssembleOp::product_states, resize_runtime_buffers(), scratch_buf_, sepset_size_, bncore::DistributeOp::sibling_cliques, bncore::DistributeOp::sibling_maps, PG::size, bncore::CliqueMargInfo::state_of_dim, bncore::VariableMetadata::states, up_changed_, up_msg_buf_, and up_msg_size_.

Referenced by BatchWorkspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_node_to_clique_map()

void bncore::BatchWorkspace::build_node_to_clique_map ( )
private

Definition at line 128 of file workspace.cpp.

References bncore::JunctionTree::cliques(), jt_, node_in_cliques_, node_to_clique_, and PG::size.

Referenced by BatchWorkspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calibrate()

void bncore::BatchWorkspace::calibrate ( )

Runs sum-product message passing with the current evidence.

Evidence is multiplied into the clique potentials, messages are passed from the leaves to the roots and back, and the calibrated belief of every clique is assembled for the query functions. Beliefs are not normalized; the query functions normalize each marginal. Parts of the tree that evidence cannot affect reuse the messages of the calibration without evidence.

When the batch size is 1, inconsistent evidence is reported by an exception. For larger batches it is not reported, and the affected rows produce all-zero marginals.

Exceptions
std::invalid_argumentif a hard evidence state index is not below the variable's state count, or, with a batch size of 1, evidence leaves a clique potential that sums to zero or hard evidence leaves the root belief with a sum of zero.

Definition at line 682 of file workspace.cpp.

References apply_soft_evidence_to_clique(), assemble_ops_, base_cal_buf_, base_down_buf_, base_up_buf_, batch_size_, cal_changed_, cal_pot_buf_, bncore::CollectOp::child_cliques, bncore::AssembleOp::child_cliques, bncore::CollectOp::child_maps, bncore::AssembleOp::child_maps, children_of_, clique_potentials_, bncore::JunctionTree::cliques(), collect_ops_, collect_order_, distribute_ops_, distribute_order_, down_changed_, bncore::DistributeOp::down_map, bncore::AssembleOp::down_map, down_msg_buf_, down_msg_size_, ev_clique_, evidence_matrix_, bncore::AssembleOp::has_down, bncore::DistributeOp::has_parent_down, is_first_calibration_, jt_, bncore::CollectOp::marg_map, bncore::DistributeOp::marg_map, parent_of_, bncore::CollectOp::pot_map, bncore::DistributeOp::pot_map, bncore::CollectOp::product_states, bncore::DistributeOp::product_states, bncore::AssembleOp::product_states, root_clique_, scratch_buf_, bncore::DistributeOp::sibling_cliques, bncore::DistributeOp::sibling_maps, soft_evidence_matrix_, soft_evidence_scalar_, up_changed_, up_msg_buf_, and up_msg_size_.

Referenced by bncore::BatchExecutionEngine::evaluate_multi(), and rebuild_clique_potentials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_evidence()

void bncore::BatchWorkspace::clear_evidence ( )

Forgets the hard evidence matrix. Soft evidence is not affected.

Definition at line 507 of file workspace.cpp.

References evidence_matrix_, and evidence_num_vars_.

Referenced by bncore::BatchExecutionEngine::evaluate_map(), bncore::BatchExecutionEngine::evaluate_multi(), rebuild_clique_potentials(), and reset().

Here is the caller graph for this function:

◆ clear_soft_evidence()

void bncore::BatchWorkspace::clear_soft_evidence ( )

Removes all soft evidence, scalar and matrix.

Definition at line 552 of file workspace.cpp.

References soft_evidence_matrix_, and soft_evidence_scalar_.

Referenced by bncore::BatchExecutionEngine::apply_soft_evidence_to_workspace().

Here is the caller graph for this function:

◆ max_calibrate()

void bncore::BatchWorkspace::max_calibrate ( )

Runs max-product propagation with the current evidence, for query_map().

The call restores the clique potentials without evidence itself, applies the evidence, and passes max messages from the leaves to the roots. The belief of each clique is its potential times the messages of its children; no messages are passed back down. Results are stored apart from those of calibrate(), so both can be held at once.

Precondition
The batch size is 1.
Exceptions
std::invalid_argumentif the batch size is not 1, a hard evidence state index is not below the variable's state count, or evidence leaves a clique potential that sums to zero.

Definition at line 1160 of file workspace.cpp.

References apply_soft_evidence_to_clique(), assemble_ops_, base_clique_potentials_, batch_size_, bncore::CollectOp::child_cliques, bncore::AssembleOp::child_cliques, bncore::CollectOp::child_maps, bncore::AssembleOp::child_maps, clique_potentials_, clique_states_, bncore::JunctionTree::cliques(), collect_ops_, collect_order_, ev_clique_, ev_scratch_active_, evidence_matrix_, jt_, map_cal_pot_buf_, map_traceback_, map_up_msg_buf_, bncore::CollectOp::marg_map, parent_of_, bncore::CollectOp::pot_map, bncore::CollectOp::product_states, bncore::AssembleOp::product_states, scratch_buf_, sepset_size_, soft_evidence_matrix_, and soft_evidence_scalar_.

Referenced by bncore::BatchExecutionEngine::evaluate_map().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_map()

void bncore::BatchWorkspace::query_map ( int *  out_states,
std::size_t  n_vars 
) const

Decodes a state for each variable from the max-product beliefs.

For each variable in the junction tree with an id below n_vars, the state written is the one with the largest belief entry in the first clique that contains the variable. Ties go to the lowest state index. Variables not in the JT are written as -1.

Precondition
max_calibrate() has run on this workspace.
Parameters
out_statesArray of n_vars ints, allocated by the caller. Entry v receives the state of the variable with NodeId v.
n_varsLength of out_states, normally the graph's variable count.

Definition at line 1257 of file workspace.cpp.

References clique_marg_info_, bncore::JunctionTree::cliques(), bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, map_cal_pot_buf_, bncore::CliqueMargInfo::n_states_total, node_to_clique_, bncore::CliqueMargInfo::state_of_dim, and bncore::VariableMetadata::states.

Referenced by bncore::BatchExecutionEngine::evaluate_map().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_marginal()

DenseTensor bncore::BatchWorkspace::query_marginal ( NodeId  node) const

Marginal of one variable from the last calibrate().

Parameters
nodeQueried variable.
Returns
Owning tensor of shape [batch_size, n_states]. Each row is normalized to sum to 1, or is all zeros if its sum is zero.
Exceptions
std::out_of_rangeif node is not a variable of the graph.
std::invalid_argumentif node is not in the junction tree.

Definition at line 1135 of file workspace.cpp.

References batch_size_, bncore::DenseTensor::data(), bncore::DenseTensor::fill(), bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, query_marginals_multi(), and bncore::VariableMetadata::states.

Here is the call graph for this function:

◆ query_marginals_multi()

void bncore::BatchWorkspace::query_marginals_multi ( const NodeId *  query_vars,
std::size_t  num_queries,
const std::size_t *  offsets,
double *  out 
) const

Marginals of several variables from the last calibrate(), with one scan of each clique involved.

out is flat, row-major [batch_size x T] with T = offsets[num_queries]. Within a row, the marginal of query q starts at offsets[q] and has one value per state. Each marginal is read from the first clique that contains the variable and is normalized to sum to 1. A marginal whose sum is zero is written as zeros.

Parameters
query_varsQueried variables, num_queries of them.
num_queriesNumber of queried variables. 0 returns at once.
offsetsPrefix offsets into an output row, num_queries + 1 entries.
outReceives batch_size * T values.
Exceptions
std::invalid_argumentif a queried variable is not in the junction tree.

Definition at line 987 of file workspace.cpp.

References batch_size_, cal_pot_buf_, clique_marg_info_, bncore::JunctionTree::cliques(), e, bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, bncore::CliqueMargInfo::n_states_total, node_to_clique_, query_visited_scratch_, bncore::CliqueMargInfo::state_of_dim, and bncore::VariableMetadata::states.

Referenced by bncore::BatchExecutionEngine::evaluate_multi(), and query_marginal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rebuild_clique_potentials()

void bncore::BatchWorkspace::rebuild_clique_potentials ( std::size_t  target_batch_size)
private

Builds the batched clique potentials from the graph's CPTs, snapshots them as the base, and runs the calibration without evidence.

Definition at line 371 of file workspace.cpp.

References base_batch_offset_, base_batch_size_, base_depends_on_offset_, calibrate(), clear_evidence(), clique_potentials_, bncore::JunctionTree::cliques(), bncore::VariableMetadata::cpt, cpt_batch_offset_, bncore::DenseTensor::data(), bncore::DenseTensor::fill(), bncore::Graph::get_parents(), bncore::Graph::get_variable(), bncore::JunctionTree::graph(), is_first_calibration_, jt_, bncore::Factor::multiply(), bncore::VariableMetadata::name, resize_runtime_buffers(), bncore::Factor::scope(), bncore::DenseTensor::shape(), PG::size, bncore::DenseTensor::size(), snapshot_base_potentials(), bncore::VariableMetadata::states, and bncore::Factor::tensor().

Referenced by BatchWorkspace(), and reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void bncore::BatchWorkspace::reset ( std::size_t  new_batch_size,
std::size_t  cpt_batch_offset = 0 
)

Prepares the workspace for a new evidence case.

Sets the batch size, forgets the hard evidence matrix and restores the clique potentials to their values without evidence. Soft evidence is kept; use clear_soft_evidence() to drop it.

If the batch size is unchanged (and, when batched CPT rows are selected by offset, the offset is unchanged too), the kept potentials are reused and the call is cheap. Otherwise all buffers are resized, the potentials are rebuilt from the graph's CPTs and the calibration without evidence is run again. CPT changes made with Graph::set_cpt() are therefore picked up only when a rebuild happens.

Parameters
new_batch_sizeNumber of evidence rows. Must be greater than 0.
cpt_batch_offsetFirst row to use from batched CPTs that have more rows than new_batch_size. Rows [cpt_batch_offset, cpt_batch_offset + new_batch_size) are used.
Exceptions
std::invalid_argumentif new_batch_size is 0, or a rebuild fails for a reason listed at the constructor.

Definition at line 475 of file workspace.cpp.

References base_batch_offset_, base_batch_size_, base_clique_potentials_, base_depends_on_offset_, batch_size_, clear_evidence(), clique_potentials_, cpt_batch_offset_, ev_scratch_active_, and rebuild_clique_potentials().

Referenced by bncore::BatchExecutionEngine::evaluate_map(), and bncore::BatchExecutionEngine::evaluate_multi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_runtime_buffers()

void bncore::BatchWorkspace::resize_runtime_buffers ( std::size_t  target_batch_size)
private

Sizes message, belief and scratch buffers for a batch size.

Definition at line 322 of file workspace.cpp.

References base_cal_buf_, base_down_buf_, base_up_buf_, cal_pot_buf_, cal_pot_size_, clique_states_, bncore::JunctionTree::cliques(), down_msg_buf_, down_msg_size_, jt_, max_product_states_, parent_of_, scratch_buf_, sepset_size_, up_msg_buf_, and up_msg_size_.

Referenced by build_message_schedule(), and rebuild_clique_potentials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_evidence_matrix()

void bncore::BatchWorkspace::set_evidence_matrix ( const int *  evidence_matrix,
std::size_t  num_vars 
)

Sets the hard evidence for the next calibration.

Only the pointer is stored. The matrix must stay valid until calibrate() or max_calibrate() has returned. State indices are checked during calibration, not here.

Parameters
evidence_matrixRow-major [batch_size x num_vars] matrix. Column v belongs to the variable with NodeId v. A negative entry means the variable is not observed in that row; otherwise the entry is the observed state index.
num_varsNumber of columns. Variables with an id of num_vars or more have no hard evidence.

Definition at line 504 of file workspace.cpp.

References evidence_matrix_, and evidence_num_vars_.

Referenced by bncore::BatchExecutionEngine::evaluate_map(), and bncore::BatchExecutionEngine::evaluate_multi().

Here is the caller graph for this function:

◆ set_soft_evidence()

void bncore::BatchWorkspace::set_soft_evidence ( NodeId  var,
const double *  likelihoods,
std::size_t  n_states 
)

Sets one likelihood vector for a variable, shared by all batch rows.

likelihoods[s] is P(measurement | variable = s). The values are copied and need not sum to 1. Matrix soft evidence stored for the same variable is removed. During calibration, soft evidence for a variable is used in place of that variable's hard evidence.

Parameters
varVariable the evidence applies to.
likelihoodsArray of n_states non-negative values.
n_statesLength of the array. Must equal the variable's state count.
Exceptions
std::out_of_rangeif var is not a variable of the graph.
std::invalid_argumentif n_states does not match or a value is negative.

Definition at line 514 of file workspace.cpp.

References bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, soft_evidence_matrix_, soft_evidence_scalar_, and bncore::VariableMetadata::states.

Referenced by bncore::BatchExecutionEngine::apply_soft_evidence_to_workspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_soft_evidence_matrix()

void bncore::BatchWorkspace::set_soft_evidence_matrix ( NodeId  var,
const double *  likelihoods_matrix,
std::size_t  n_states 
)

Sets a separate likelihood vector per batch row for a variable.

likelihoods_matrix[b * n_states + s] is the likelihood of state s for batch row b. The call copies batch_size * n_states values using the current batch size, so call it after reset(). Scalar soft evidence stored for the same variable is removed.

Parameters
varVariable the evidence applies to.
likelihoods_matrixRow-major [batch_size x n_states] array of non-negative values.
n_statesState count of the variable.
Exceptions
std::out_of_rangeif var is not a variable of the graph.
std::invalid_argumentif n_states does not match or a value is negative.

Definition at line 532 of file workspace.cpp.

References batch_size_, bncore::Graph::get_variable(), bncore::JunctionTree::graph(), jt_, soft_evidence_matrix_, soft_evidence_scalar_, and bncore::VariableMetadata::states.

Referenced by bncore::BatchExecutionEngine::apply_soft_evidence_to_workspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ snapshot_base_potentials()

void bncore::BatchWorkspace::snapshot_base_potentials ( )
private

Copies clique_potentials_ into owning base_clique_potentials_.

Definition at line 360 of file workspace.cpp.

References base_clique_potentials_, clique_potentials_, bncore::DenseTensor::data(), and bncore::Factor::tensor().

Referenced by rebuild_clique_potentials().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ assemble_ops_

std::vector<AssembleOp> bncore::BatchWorkspace::assemble_ops_
private

Definition at line 345 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and max_calibrate().

◆ base_batch_offset_

std::size_t bncore::BatchWorkspace::base_batch_offset_ = 0
private

Definition at line 317 of file workspace.hpp.

Referenced by rebuild_clique_potentials(), and reset().

◆ base_batch_size_

std::size_t bncore::BatchWorkspace::base_batch_size_ = 0
private

Definition at line 316 of file workspace.hpp.

Referenced by rebuild_clique_potentials(), and reset().

◆ base_cal_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::base_cal_buf_
private

Definition at line 377 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ base_clique_potentials_

std::vector<Factor> bncore::BatchWorkspace::base_clique_potentials_
private

Definition at line 315 of file workspace.hpp.

Referenced by max_calibrate(), reset(), and snapshot_base_potentials().

◆ base_depends_on_offset_

bool bncore::BatchWorkspace::base_depends_on_offset_ = false
private

Definition at line 318 of file workspace.hpp.

Referenced by rebuild_clique_potentials(), and reset().

◆ base_down_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::base_down_buf_
private

Definition at line 376 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ base_up_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::base_up_buf_
private

Definition at line 375 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ batch_size_

◆ cal_changed_

std::vector<uint8_t> bncore::BatchWorkspace::cal_changed_
private

Definition at line 359 of file workspace.hpp.

Referenced by build_message_schedule(), and calibrate().

◆ cal_pot_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::cal_pot_buf_
private

◆ cal_pot_size_

std::vector<std::size_t> bncore::BatchWorkspace::cal_pot_size_
private

Definition at line 363 of file workspace.hpp.

Referenced by build_message_schedule(), and resize_runtime_buffers().

◆ children_of_

std::vector<std::vector<std::size_t> > bncore::BatchWorkspace::children_of_
private

Definition at line 333 of file workspace.hpp.

Referenced by BatchWorkspace(), build_message_schedule(), and calibrate().

◆ clique_marg_info_

std::vector<CliqueMargInfo> bncore::BatchWorkspace::clique_marg_info_
private

◆ clique_potentials_

std::vector<Factor> bncore::BatchWorkspace::clique_potentials_
private

◆ clique_states_

std::vector<std::size_t> bncore::BatchWorkspace::clique_states_
private

◆ collect_ops_

std::vector<CollectOp> bncore::BatchWorkspace::collect_ops_
private

Definition at line 343 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and max_calibrate().

◆ collect_order_

std::vector<std::size_t> bncore::BatchWorkspace::collect_order_
private

Definition at line 330 of file workspace.hpp.

Referenced by BatchWorkspace(), build_message_schedule(), calibrate(), and max_calibrate().

◆ cpt_batch_offset_

std::size_t bncore::BatchWorkspace::cpt_batch_offset_ = 0
private

Definition at line 312 of file workspace.hpp.

Referenced by rebuild_clique_potentials(), and reset().

◆ distribute_ops_

std::vector<DistributeOp> bncore::BatchWorkspace::distribute_ops_
private

Definition at line 344 of file workspace.hpp.

Referenced by build_message_schedule(), and calibrate().

◆ distribute_order_

std::vector<std::size_t> bncore::BatchWorkspace::distribute_order_
private

Definition at line 331 of file workspace.hpp.

Referenced by BatchWorkspace(), build_message_schedule(), and calibrate().

◆ down_changed_

std::vector<uint8_t> bncore::BatchWorkspace::down_changed_
private

Definition at line 358 of file workspace.hpp.

Referenced by build_message_schedule(), and calibrate().

◆ down_msg_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::down_msg_buf_
private

Definition at line 337 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ down_msg_size_

std::vector<std::size_t> bncore::BatchWorkspace::down_msg_size_
private

Definition at line 339 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ ev_clique_

std::vector<uint8_t> bncore::BatchWorkspace::ev_clique_
private

◆ ev_scratch_

std::vector<std::vector<double> > bncore::BatchWorkspace::ev_scratch_
private

Definition at line 385 of file workspace.hpp.

Referenced by apply_soft_evidence_to_clique(), and build_message_schedule().

◆ ev_scratch_active_

std::vector<bool> bncore::BatchWorkspace::ev_scratch_active_
private

◆ evidence_matrix_

const int* bncore::BatchWorkspace::evidence_matrix_ = nullptr
private

◆ evidence_num_vars_

std::size_t bncore::BatchWorkspace::evidence_num_vars_ = 0
private

◆ is_first_calibration_

bool bncore::BatchWorkspace::is_first_calibration_ = true
private

Definition at line 378 of file workspace.hpp.

Referenced by calibrate(), and rebuild_clique_potentials().

◆ jt_

◆ map_cal_pot_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::map_cal_pot_buf_
private

Definition at line 372 of file workspace.hpp.

Referenced by max_calibrate(), and query_map().

◆ map_traceback_

std::vector<std::vector<uint32_t> > bncore::BatchWorkspace::map_traceback_
private

Definition at line 370 of file workspace.hpp.

Referenced by max_calibrate().

◆ map_up_msg_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::map_up_msg_buf_
private

Definition at line 367 of file workspace.hpp.

Referenced by max_calibrate().

◆ max_product_states_

std::size_t bncore::BatchWorkspace::max_product_states_ = 0
private

Definition at line 351 of file workspace.hpp.

Referenced by build_message_schedule(), and resize_runtime_buffers().

◆ node_in_cliques_

std::unordered_map<NodeId, std::vector<std::size_t> > bncore::BatchWorkspace::node_in_cliques_
private

Definition at line 391 of file workspace.hpp.

Referenced by build_node_to_clique_map().

◆ node_to_clique_

std::unordered_map<NodeId, std::size_t> bncore::BatchWorkspace::node_to_clique_
private

Definition at line 390 of file workspace.hpp.

Referenced by build_node_to_clique_map(), query_map(), and query_marginals_multi().

◆ parent_of_

std::vector<std::size_t> bncore::BatchWorkspace::parent_of_
private

◆ query_visited_scratch_

std::vector<uint8_t> bncore::BatchWorkspace::query_visited_scratch_
mutableprivate

Definition at line 394 of file workspace.hpp.

Referenced by query_marginals_multi().

◆ root_clique_

std::size_t bncore::BatchWorkspace::root_clique_
private

Definition at line 329 of file workspace.hpp.

Referenced by BatchWorkspace(), and calibrate().

◆ scratch_buf_

std::vector<double> bncore::BatchWorkspace::scratch_buf_
private

◆ sepset_size_

std::vector<std::size_t> bncore::BatchWorkspace::sepset_size_
private

Definition at line 340 of file workspace.hpp.

Referenced by build_message_schedule(), max_calibrate(), and resize_runtime_buffers().

◆ soft_evidence_matrix_

std::unordered_map<NodeId, std::vector<double> > bncore::BatchWorkspace::soft_evidence_matrix_
private

◆ soft_evidence_scalar_

std::unordered_map<NodeId, std::vector<double> > bncore::BatchWorkspace::soft_evidence_scalar_
private

◆ up_changed_

std::vector<uint8_t> bncore::BatchWorkspace::up_changed_
private

Definition at line 357 of file workspace.hpp.

Referenced by build_message_schedule(), and calibrate().

◆ up_msg_buf_

std::vector<std::vector<double> > bncore::BatchWorkspace::up_msg_buf_
private

Definition at line 336 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().

◆ up_msg_size_

std::vector<std::size_t> bncore::BatchWorkspace::up_msg_size_
private

Definition at line 338 of file workspace.hpp.

Referenced by build_message_schedule(), calibrate(), and resize_runtime_buffers().


The documentation for this class was generated from the following files: