The implementation of phase retrieval algorithm