Skip to content

Instantly share code, notes, and snippets.

@smrfeld
Created July 12, 2020 21:49
Show Gist options
  • Save smrfeld/3140f3a3d34af3feb9b1f4f819172297 to your computer and use it in GitHub Desktop.
Save smrfeld/3140f3a3d34af3feb9b1f4f819172297 to your computer and use it in GitHub Desktop.
Second Carma method
py::array_t<double> sample(const py::array_t<double> &state_init, int no_steps) const {
// Convert to arma
arma::imat state_init_arma = carma::arr_to_mat<arma::sword>(state_init);
// Call
arma::imat state_arma = GibbsSampler::sample(state_init_arma, no_steps);
// Convert back to NumPy
py::array_t<double> state = carma::mat_to_arr<arma::sword>(state_arma);
return state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment