Skip to content

Instantly share code, notes, and snippets.

@jtilly jtilly/print_mat.h
Created Nov 29, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.