inv_p function

Calculate the inverse of a matrix mod p