Prim matrix testing