/*
This code contains functions to make Gibbs sampling for a Restricted Boltzman machine model. It does what "gibbs.f2" in 5_20_13.R does.
The goal is to use C to speed up MCMC sampling that was initially done in R.
Compile with
gcc -Wall -pedantic -std=gnu99 -shared -I/apps/lib64/R/include -I/usr/local/include -fPIC -o gibbsRBM.so gibbsRBM.c -lm
*/
#include
#include
#include
#include
#include
#include
/* function to compute vector dot product*/
double vector_dot_prod(double *a, double *b, int n)
{
double val=0;
int i;
for (i=0; i