q_matrix function

Convert a standard matrix to a q_matrix object