Calls the weighting function corresponding to the current value of weighting_type in the solution structure. After weighting has been done this function calculates sigma - a weighted measure of standard deviation of residuals that is used in iteration control in function decide_iter. This function also records the values of alpha (which is calculated in the weighting function itself) and sigma from the previous iteration as prev_alpha and prev_sigma. These are compared with the current values in function decide_iter to tell if the solution is converged or diverging.