  Photo-z error is one of the major sources of systematics degrading the
accuracy of weak lensing cosmological inferences. Zhang et al. (2010) proposed
a self-calibration method combining galaxy-galaxy correlations and galaxy-shear
correlations between different photo-z bins. Fisher matrix analysis shows that
it can determine the rate of photo-z outliers at a level of 0.01-1% merely
using photometric data and do not rely on any prior knowledge. In this paper,
we develop a new algorithm to implement this method by solving a constrained
nonlinear optimization problem arising in the self-calibration process. Based
on the techniques of fixed-point iteration and non-negative matrix
factorization, the proposed algorithm can efficiently and robustly reconstruct
the scattering probabilities between the true-z and photo-z bins. The algorithm
has been tested extensively by applying it to mock data from simulated stage IV
weak lensing projects. We find that the algorithm provides a successful
recovery of the scatter rates at the level of 0.01-1%, and the true mean
redshifts of photo-z bins at the level of 0.001, which may satisfy the
requirements in future lensing surveys.
