merge two methods which did the same computations. 0 pointer is used if out_weight is not needed
Authored by: sergipujades 2013-05-22
Parent: [r135]
Child: [r137]