I found a way to print armadillo matrix in gdb on this site . However, what happens if
#include <iostream>
#include <armadillo>
template<class Matrix>
void print_matrix(Matrix matrix) {
matrix.print(std::cout);
}
//provide explicit instantiations of the template function for
//every matrix type you use somewhere in your program.
template void print_matrix<arma::mat>(arma::mat matrix);
template void print_matrix<arma::cx_mat>(arma::cx_mat matrix);
is inside debug_armadillo.h file. How call function should be performed? I tried to type:
call 'debug_armadillo.h'::print_matrix<arma::Mat<float>>(C)
but the error I get is:
No symbol "print_matrix" in specified context.
This call should work. Use Tab completion to autocomplete exact C++ type as suggested in https://stackoverflow.com/a/22766955/72178.
Make sure that
print_matrix
function was actually generated in resulting binary. Try togrep
demangled symbols, probably exact type differs a bit in template arguments from what you are trying to call: