tfmri.math.indicator_simplex

indicator_simplex(x, radius=1.0, name=None)[source]

Indicator function of the simplex.

Returns 0 if x is in the simplex, inf otherwise.

The simplex of radius \(r\) is defined as the set of points of \(\mathbb{R}^{n}\) whose elements are nonnegative and sum up to r.

\[\Delta_r = \left\{x \in \mathbb{R}^{n} : \sum_{i=1}^{n} x_i = r \text{ and } x_i >= 0, \forall i = 1, \dots, n \right\}\]

If \(r\) is 1, the simplex is also called the unit simplex, standard simplex or probability simplex.

Parameters
  • x – A tf.Tensor of shape [..., n].

  • radius

    A scalar tf.Tensor. The radius of the circumscribed circle of the simplex, or the distance to the vertices. Defaults to 1.

  • name – A str. The name of this operation.

Returns

A tf.Tensor of shape [...] and dtype equal to x.dtype.real_dtype.

Raises

ValueError – If inputs are invalid.