Slight efficiency for sparse hellinger
@@ -512,13 +512,13 @@ def sparse_cosine(ind1, data1, ind2, data2):
@numba.njit()
def sparse_hellinger(ind1, data1, ind2, data2):
- aux_inds, aux_data = sparse_mul(ind1, np.sqrt(data1), ind2, np.sqrt(data2))
+ aux_inds, aux_data = sparse_mul(ind1, data1, ind2, data2)
result = 0.0
norm1 = np.sum(data1)
norm2 = np.sum(data2)
for i in range(aux_data.shape[0]):
- result += aux_data[i]
+ result += np.sqrt(aux_data[i])
if norm1 == 0.0 and norm2 == 0.0:
return 0.0
