Implements weighting for gmm_with_weighting (finally).

Notes: This is slow(!) and doesn't add one term from B&W
(see gen_params).  It just takes care of calculating and using the
weighting matrix.

Two new functions are added to do the calculations: f and gen_weight.

Some changes made to the calling convention to accomodate these
changes.