extended mean to accept a weight vector