---
title: "ClikaRT::ops::pdist"
sidebar_label: "pdist"
description: "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). input the rows [M, K]."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## pdist() {#pdist}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`pdist`**([`Tensor`](../Tensor.md) `input`, [`Scalar`](../Scalar.md) `p` `=` `2.0`)

</div>

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**

- `input`: the rows `[M, K]`.
- `p`: the norm degree, an int or float [`Scalar`](../Scalar.md), kind-preserved; default 2.

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

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `input` is not rank-2.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 2957

</div>
