Analysis and development of phase retrieval algorithms for ptychography