Skip to main content

ClikaRT::ops::pdist

function

pdist()

Tensor pdist(Tensor a, Scalar p = 2.0)

Condensed pairwise L_p distances within ONE 2-D input.

Every unordered row pair of a [M, K] yields one entry; the output is 1-D of length M(M-1)/2 (upper-triangle order).

Parameters

  • a: the rows [M, K].
  • p: the norm degree, an int or float Scalar, kind-preserved; default 2.

Returns: the condensed distances [M(M-1)/2].

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when a is not rank-2.

Declared in ClikaRT/compute/ops.h, line 2870