class_docstr: Tangent space of M for Simplex distributions in R^n.
class_docstr_tok: ["Tangent","space","of","M","for","Simplex","distributions","in","R^n","."]
docstr: Returns a `TangentSpace` of a n-simplex.
docstr_tok: ["Returns","a","`","TangentSpace","`","of","a","n-simplex","."]
code: def compute_basis(self, x):
      """Returns a `TangentSpace` of a n-simplex."""
      # The tangent space of the simplex satisfies `{x | <1, x> = 0}`, where `1`
      # is the vector of all `1`s. This can be seen by the fact that `1` is
      # orthogonal to the unit simplex.
      # We can do this by using the basis:  e_i - e_n, 1 <= i <= n - 1. For n = 4,
      # this looks like:
      # [[1, 0., 0., -1],
      #  [0, 1., 0., -1],
      #  [0, 0., 1., -1]]
      dim = ps.shape(x)[-1]
      block1 = tf.linalg.LinearOperatorIdentity(
          num_rows=dim - 1, dtype=x.dtype
      )
      block2 = tf.linalg.LinearOperatorFullMatrix(
          -tf.ones([dim - 1, 1], dtype=x.dtype)
      )
      simplex_basis_linop = lorb.LinearOperatorRowBlock(
          [block1, block2]
      )
      return spaces.LinearOperatorBasis(simplex_basis_linop)
  
file_path: probability/tensorflow_probability/python/experimental/tangent_spaces/simplex.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.experimental.linalg import linear_operator_row_block
  from tensorflow_probability.python.experimental.tangent_spaces import spaces
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 1 for calling the ProbabilitySimplexSpace obj's underlying member method code with example usage: obj.compute_basis(x) and returns: spaces