build p1 matrix