Update generic_matrix_tools.hpp