calculate chi-squre kernel directly