original_docstring: Create a fermionic operator that is the generator of uccsd.
  
      This a the most straight-forward method to generate UCCSD operators,
      however it is slightly inefficient.  In particular, it parameterizes
      all possible exictations, so it represents a generalized unitary coupled
      cluster ansatz, but also does not explicitly enforce the uniqueness
      in paramterization, so it is redundant. For example there will be a linear
      dependency in the ansatz of single_amplitudes[i,j] and
      single_amplitudes[j,i].
  
      Args:
          single_amplitudes(ndarray): [NxN] array storing single excitation
              amplitudes corresponding to t[i,j] * (a_i^\dagger a_j + H.C.)
          double_amplitudes(ndarray): [NxNxNxN] array storing double excitation
              amplitudes corresponding to
              t[i,j,k,l] * (a_i^\dagger a_j a_k^\dagger a_l + H.C.)
          anti_hermitian(Bool): Flag to generate only normal CCSD operator
              rather than unitary variant, primarily for testing
  
      Returns:
          uccsd_generator(FermionOperator): Anti-hermitian fermion operator that
          is the generator for the uccsd wavefunction.
      
docstring: Create a fermionic operator that is the generator of uccsd.
  This a the most straight-forward method to generate UCCSD operators,
  however it is slightly inefficient.  In particular, it parameterizes
  all possible exictations, so it represents a generalized unitary coupled
  cluster ansatz, but also does not explicitly enforce the uniqueness
  in paramterization, so it is redundant. For example there will be a linear
  dependency in the ansatz of single_amplitudes[i,j] and
  single_amplitudes[j,i].
docstring_tokens: Create a fermionic operator that is the generator of uccsd . This a the most straight - forward method to generate UCCSD operators however it is slightly inefficient . In particular it parameterizes all possible exictations so it represents a generalized unitary coupled cluster ansatz but also does not explicitly enforce the uniqueness in paramterization so it is redundant . For example there will be a linear dependency in the ansatz of single_amplitudes [ i j ] and single_amplitudes [ j i ] .
code: def uccsd_operator(single_amplitudes, double_amplitudes, anti_hermitian=True):
      """Create a fermionic operator that is the generator of uccsd.
  
      This a the most straight-forward method to generate UCCSD operators,
      however it is slightly inefficient.  In particular, it parameterizes
      all possible exictations, so it represents a generalized unitary coupled
      cluster ansatz, but also does not explicitly enforce the uniqueness
      in paramterization, so it is redundant. For example there will be a linear
      dependency in the ansatz of single_amplitudes[i,j] and
      single_amplitudes[j,i].
  
      Args:
          single_amplitudes(ndarray): [NxN] array storing single excitation
              amplitudes corresponding to t[i,j] * (a_i^\dagger a_j + H.C.)
          double_amplitudes(ndarray): [NxNxNxN] array storing double excitation
              amplitudes corresponding to
              t[i,j,k,l] * (a_i^\dagger a_j a_k^\dagger a_l + H.C.)
          anti_hermitian(Bool): Flag to generate only normal CCSD operator
              rather than unitary variant, primarily for testing
  
      Returns:
          uccsd_generator(FermionOperator): Anti-hermitian fermion operator that
          is the generator for the uccsd wavefunction.
      """
      n_orbitals = single_amplitudes.shape[0]
      assert(n_orbitals == double_amplitudes.shape[0])
      uccsd_generator = FermionOperator()
  
      # Add single excitations
      for i, j in itertools.product(range(n_orbitals), repeat=2):
          if single_amplitudes[i, j] == 0.:
              continue
          uccsd_generator += FermionOperator(
              ((i, 1), (j, 0)), single_amplitudes[i, j])
          if (anti_hermitian):
              uccsd_generator += FermionOperator(
                  ((j, 1), (i, 0)), -single_amplitudes[i, j])
  
          # Add double excitations
      for i, j, k, l in itertools.product(range(n_orbitals), repeat=4):
          if double_amplitudes[i, j, k, l] == 0.:
              continue
          uccsd_generator += FermionOperator(
              ((i, 1), (j, 0), (k, 1), (l, 0)),
              double_amplitudes[i, j, k, l])
          if (anti_hermitian):
              uccsd_generator += FermionOperator(
                  ((l, 1), (k, 0), (j, 1), (i, 0)),
                  -double_amplitudes[i, j, k, l])
  
      return uccsd_generator
code_tokens: def uccsd_operator ( single_amplitudes , double_amplitudes , anti_hermitian = True ) : n_orbitals = single_amplitudes . shape [ 0 ] assert ( n_orbitals == double_amplitudes . shape [ 0 ] ) uccsd_generator = FermionOperator ( ) for i , j in itertools . product ( range ( n_orbitals ) , repeat = 2 ) : if single_amplitudes [ i , j ] == 0. : continue uccsd_generator += FermionOperator ( ( ( i , 1 ) , ( j , 0 ) ) , single_amplitudes [ i , j ] ) if ( anti_hermitian ) : uccsd_generator += FermionOperator ( ( ( j , 1 ) , ( i , 0 ) ) , - single_amplitudes [ i , j ] ) for i , j , k , l in itertools . product ( range ( n_orbitals ) , repeat = 4 ) : if double_amplitudes [ i , j , k , l ] == 0. : continue uccsd_generator += FermionOperator ( ( ( i , 1 ) , ( j , 0 ) , ( k , 1 ) , ( l , 0 ) ) , double_amplitudes [ i , j , k , l ] ) if ( anti_hermitian ) : uccsd_generator += FermionOperator ( ( ( l , 1 ) , ( k , 0 ) , ( j , 1 ) , ( i , 0 ) ) , - double_amplitudes [ i , j , k , l ] ) return uccsd_generator
short_docstring: Create a fermionic operator that is the generator of uccsd.
short_docstring_tokens: Create a fermionic operator that is the generator of uccsd .
comment: """Create a fermionic operator that is the generator of uccsd.
  
      This a the most straight-forward method to generate UCCSD operators,
      however it is slightly inefficient.  In particular, it parameterizes
      all possible exictations, so it represents a generalized unitary coupled
      cluster ansatz, but also does not explicitly enforce the uniqueness
      in paramterization, so it is redundant. For example there will be a linear
      dependency in the ansatz of single_amplitudes[i,j] and
      single_amplitudes[j,i].
  
      Args:
          single_amplitudes(ndarray): [NxN] array storing single excitation
              amplitudes corresponding to t[i,j] * (a_i^\dagger a_j + H.C.)
          double_amplitudes(ndarray): [NxNxNxN] array storing double excitation
              amplitudes corresponding to
              t[i,j,k,l] * (a_i^\dagger a_j a_k^\dagger a_l + H.C.)
          anti_hermitian(Bool): Flag to generate only normal CCSD operator
              rather than unitary variant, primarily for testing
  
      Returns:
          uccsd_generator(FermionOperator): Anti-hermitian fermion operator that
          is the generator for the uccsd wavefunction.
      """$SEP$# Add single excitations$SEP$# Add double excitations