least-square algorithm