computation of weights