Simultaneous least squares fitter based on the Lagrange multiplier method