simplex_project#

iskra.geometry.distances.simplex_project(x: Tensor, simplices: Tensor) Tensor[SOURCE]#

Projects a point onto the closest point on a simplex.

!!! tip

Internally broadcasts x, simplices together, meaning it can be used to project many points onto a single simplex, one point onto many simplices or many points to many simplices, all by adding singleton dimensions to the batches before calling the function. Bs3 are the output batch dimensions obtained by broadcasting Bs1 and Bs2 together.

Parameters:
  • x (Tensor[Float, [Bs1, Dim]]) – Set of points.

  • simplices (Tensor[Float, [Bs2, S, Dim]]) – Set of simplices.

Returns:

(Tensor[Float, [Bs3, Dim]]) – Closest projection of x onto its corresponding simplex.