computing weights