class_docstr: Class for the vector space of symmetric matrices of size n.
  
  Parameters
  ----------
  n : int
      Integer representing the shapes of the matrices: n x n.
class_docstr_tok: ["Class","for","the","vector","space","of","symmetric","matrices","of","size","n.","Parameters","--","--","--","--","--","n",":","int","Integer","representing","the","shapes","of","the","matrices",":","n","x","n","."]
docstr: Convert a vector into a symmetric matrix.
  
  Parameters
  ----------
  basis_representation : array-like, shape=[..., n(n+1)/2]
      Vector.
  
  Returns
  -------
  matrix_representation : array-like, shape=[..., n, n]
      Symmetric matrix.
docstr_tok: ["Convert","a","vector","into","a","symmetric","matrix",".","Parameters","--","--","--","--","--","basis_representation",":","array-like",",","shape=","[","...",",","n","(","n+1",")","\/2","]","Vector",".","Returns","--","--","--","-","matrix_representation",":","array-like",",","shape=","[","...",",","n",",","n","]","Symmetric","matrix","."]
code: def matrix_representation(basis_representation):
      """Convert a vector into a symmetric matrix.
  
      Parameters
      ----------
      basis_representation : array-like, shape=[..., n(n+1)/2]
          Vector.
  
      Returns
      -------
      matrix_representation : array-like, shape=[..., n, n]
          Symmetric matrix.
      """
      vec_dim = basis_representation.shape[-1]
      mat_dim = (gs.sqrt(8.0 * vec_dim + 1) - 1) / 2
      if mat_dim != int(mat_dim):
          raise ValueError(
              "Invalid input dimension, it must be of the form"
              "(n_samples, n * (n + 1) / 2)"
          )
      mat_dim = int(mat_dim)
      shape = (mat_dim, mat_dim)
      mask = 2 * gs.ones(shape) - gs.eye(mat_dim)
      indices = list(zip(*gs.triu_indices(mat_dim)))
      if gs.ndim(basis_representation) == 1:
          upper_triangular = gs.array_from_sparse(
              indices, basis_representation, shape
          )
      else:
          upper_triangular = gs.stack(
              [
                  gs.array_from_sparse(indices, data, shape)
                  for data in basis_representation
              ]
          )
  
      mat = Matrices.to_symmetric(upper_triangular) * mask
      return mat
  
file_path: geomstats/geomstats/geometry/symmetric_matrices.py
imports: import geomstats.backend
  from geomstats.geometry.base import MatrixVectorSpace
  from geomstats.geometry.matrices import Matrices, MatricesMetric
label_desc: Use image node_id 7 for calling the SymmetricMatrices obj's underlying member method code with example usage: obj.matrix_representation(basis_representation) and returns: mat