original_docstring:  Indices for scalars, and also additional scalar gates
          added by gated(sumrep)
docstring: Indices for scalars, and also additional scalar gates
  added by gated(sumrep)
docstring_tokens: Indices for scalars and also additional scalar gates added by gated ( sumrep )
code: def gate_indices(sumrep): #TODO: add support for mixed_tensors
      """ Indices for scalars, and also additional scalar gates
          added by gated(sumrep)"""
      assert isinstance(sumrep,SumRep), f"unexpected type for gate indices {type(sumrep)}"
      channels = sumrep.size()
      perm = sumrep.perm
      indices = np.arange(channels)
      num_nonscalars = 0
      i=0
      for rep in sumrep:
          if rep!=Scalar and not rep.is_permutation:
              indices[perm[i:i+rep.size()]] = channels+num_nonscalars
              num_nonscalars+=1
          i+=rep.size()
      return indices
code_tokens: def gate_indices ( sumrep ) : assert isinstance ( sumrep , SumRep ) , f"unexpected type for gate indices {type(sumrep)}" channels = sumrep . size ( ) perm = sumrep . perm indices = np . arange ( channels ) num_nonscalars = 0 i = 0 for rep in sumrep : if rep != Scalar and not rep . is_permutation : indices [ perm [ i : i + rep . size ( ) ] ] = channels + num_nonscalars num_nonscalars += 1 i += rep . size ( ) return indices
short_docstring: Indices for scalars, and also additional scalar gates
  added by gated(sumrep)
short_docstring_tokens: Indices for scalars and also additional scalar gates added by gated ( sumrep )
comment: #TODO: add support for mixed_tensors
  $SEP$""" Indices for scalars, and also additional scalar gates
          added by gated(sumrep)"""