Skip to content

Instantly share code, notes, and snippets.

@jtilly
Created November 29, 2016 17:38
Show Gist options
  • Save jtilly/549dc0fd61109e48ee4e9d41cfbbc396 to your computer and use it in GitHub Desktop.
Save jtilly/549dc0fd61109e48ee4e9d41cfbbc396 to your computer and use it in GitHub Desktop.
Simple helper function to print armadillo matrices
#ifndef print_mat_h
#define print_mat_h
void print_mat(arma::mat my_matrix) {
uint cols = my_matrix.n_cols;
uint rows = my_matrix.n_rows;
Rcout << "--------\n";
for(uint rX = 0; rX < rows; rX++) {
Rcout << " " << rX << ": ";
for(uint cX = 0; cX < cols; cX++) {
Rcout << my_matrix(rX, cX) << " ";
}
Rcout << "\n";
}
Rcout << "--------\n";
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment