Loading [MathJax]/extensions/tex2jax.js
mrf  v0.2.0
All Data Structures Files Functions Pages
mrf.c File Reference
#include <stdlib.h>
#include <mrf.h>

Functions

void all_message_product (struct Node *node, struct Message *out_msg)
 
void bp (struct Node **nodes, int num_nodes, int num_iterations)
 Loopy belief propagation. More...
 
void compute_message (struct Node *from, struct Node *to, struct Message *out_msg)
 Computes the message from node i to node j. More...
 
void compute_univariate_marginal (struct Node *node, struct Factor1D *out)
 Computes the univariate marginal probability distribution over the node's values. More...
 
void connect_factor1d (struct Node *n, struct Factor1D *fac)
 Connects a node with its prior. More...
 
void connect_nodes (struct Node *n1, struct Node *n2, struct Factor2D *fac)
 Connect two nodes with their joining bivariate factor. More...
 
void delete_factor1d (struct Factor1D *fac)
 Delete the Factor1D. More...
 
void delete_factor2d (struct Factor2D *fac)
 Delete the Factor2D. More...
 
void delete_message (struct Message *msg)
 Delete the message. More...
 
void delete_messages (struct Node *n)
 
void delete_node (struct Node *node)
 Delete the node. More...
 
double factor1d_at (struct Factor1D *fac, int ix)
 Access the value in the factor at the specified index. More...
 
void factor1d_ix (struct Factor1D *fac, int ix, double value)
 Set the value in the factor at the specified index. More...
 
double factor2d_at (struct Factor2D *fac, int row, int col)
 Access the value in the factor at the specified row and column. More...
 
void factor2d_ix (struct Factor2D *fac, int row, int col, double value)
 Set the value in the factor at the specified row and column. More...
 
struct Factor2Dfind_factor2d (struct Node *from, int to)
 
void increment_connect_ctr (struct Node *n)
 
void increment_recv_ctr (struct Node *n)
 
void initialize_messages (struct Node *n)
 
double message_at (struct Message *msg, int ix)
 Access the value in the message at the specified index. More...
 
void message_ix (struct Message *msg, int ix, double value)
 Set the value in the message at the specified index. More...
 
void message_product (struct Node *from, struct Node *to, struct Message *out_msg)
 Computes the product of messages incoming to a node. More...
 
struct Factor1Dnew_factor1d (int dim)
 Craete a new uninitialized Factor1D. More...
 
struct Factor1Dnew_factor1d_uniform_prior (int dim)
 Create a Factor1D with entries \(f_i(x_i) = 1/dim\). More...
 
struct Factor2Dnew_factor2d (int rows, int cols)
 Create a new uninitialized Factor2D. More...
 
struct Factor2Dnew_factor2d_uniform_prior (int rows, int cols)
 Create a Factor2D with entries \(f_{ij}(x_i, x_j) = (rows * cols)^{-1}\). More...
 
struct Messagenew_message (int dim, int from, int to)
 Create a new message and assign it the specified origin and destination. More...
 
struct Messagenew_message_unassigned (int dim)
 Create a new message that is not assigned to any node. More...
 
struct Messagenew_message_unit (int dim, int from, int to)
 Create a new message with values \(\mu_{ij}(x_i) = 1\). More...
 
struct Nodenew_node (int id, int degree, int dim)
 Create a new node. More...
 
void normalize_message (struct Message *msg)
 
void reset_messages (struct Node *n)
 Resets all messages in the node's inbox to one. More...
 
void send_messages (struct Node *from)
 Sends messages from the node to all of its neighbors. More...
 
void set_evidence (struct Node *n, int value)
 Condition the variable to be equal to the value. More...
 
void set_evidence_factor1d (struct Factor1D *fac, int index)
 
void set_evidence_factor2d_col (struct Factor2D *fac, int index)
 
void set_evidence_factor2d_row (struct Factor2D *fac, int index)
 
void sum_out_col (struct Node *from, struct Message *prod, struct Message *out_msg)
 
void sum_out_row (struct Node *from, struct Message *prod, struct Message *out_msg)
 

Detailed Description

Author
David Dewhurst (david.nosp@m.@drd.nosp@m.ewhur.nosp@m.st.c.nosp@m.om)
Version
0.1
Date
2024-01-13