prim_matrix