cr.sparse.pairwise_sqr_l2_distances_cw

cr.sparse.pairwise_sqr_l2_distances_cw(A, B)[source]

Computes the pairwise squared distances between points in A and points in B where each point is a column vector

Parameters
Returns

An MxN matrix D of squared distances between points in A and points in B

Return type

(jax.numpy.ndarray)

  • Let the ambient space of points be \(\mathbb{F}^K\).

  • \(A\) contains the points \(a_i\) with \(1 \leq i \leq M\) and each point maps to a column of \(A\).

  • \(B\) contains the points \(b_j\) with \(1 \leq j \leq N\) and each point maps to a column of \(B\).

Then the distance matrix \(D\) is of size \(M \times N\) and consists of:

(1)\[d_{i, j} = \| a_i - b_j \|_2^2 = \langle a_i - b_j , a_i - b_j \rangle\]