original_docstring: r"""
          Calculate the unentangled value of an extended nonlocal game.
  
          The *unentangled value* of an extended nonlocal game is the supremum
          value for Alice and Bob's winning probability in the game over all
          unentangled strategies. Due to convexity and compactness, it is possible
          to calculate the unentangled extended nonlocal game by:
  
          .. math::
              \omega(G) = \max_{f, g}
              \lVert
              \sum_{(x,y) \in \Sigma_A \times \Sigma_B} \pi(x,y)
              V(f(x), g(y)|x, y)
              \rVert
  
          where the maximum is over all functions :math:`f : \Sigma_A \rightarrow
          \Gamma_A` and :math:`g : \Sigma_B \rightarrow \Gamma_B`.
  
          :return: The unentangled value of the extended nonlocal game.
          
docstring: r"""
  Calculate the unentangled value of an extended nonlocal game.
  
  The *unentangled value* of an extended nonlocal game is the supremum
  value for Alice and Bob's winning probability in the game over all
  unentangled strategies. Due to convexity and compactness, it is possible
  to calculate the unentangled extended nonlocal game by.
  
  
  
  
docstring_tokens: r " " " Calculate the unentangled value of an extended nonlocal game . The * unentangled value * of an extended nonlocal game is the supremum value for Alice and Bob ' s winning probability in the game over all unentangled strategies . Due to convexity and compactness it is possible to calculate the unentangled extended nonlocal game by .
code: def unentangled_value(self) -> float:
          r"""
          Calculate the unentangled value of an extended nonlocal game.
  
          The *unentangled value* of an extended nonlocal game is the supremum
          value for Alice and Bob's winning probability in the game over all
          unentangled strategies. Due to convexity and compactness, it is possible
          to calculate the unentangled extended nonlocal game by:
  
          .. math::
              \omega(G) = \max_{f, g}
              \lVert
              \sum_{(x,y) \in \Sigma_A \times \Sigma_B} \pi(x,y)
              V(f(x), g(y)|x, y)
              \rVert
  
          where the maximum is over all functions :math:`f : \Sigma_A \rightarrow
          \Gamma_A` and :math:`g : \Sigma_B \rightarrow \Gamma_B`.
  
          :return: The unentangled value of the extended nonlocal game.
          """
          dim_x, dim_y, alice_out, bob_out, alice_in, bob_in = self.pred_mat.shape
  
          max_unent_val = float("-inf")
          for a_out in range(alice_out):
              for b_out in range(bob_out):
                  p_win = np.zeros([dim_x, dim_y], dtype=complex)
                  for x_in in range(alice_in):
                      for y_in in range(bob_in):
                          p_win += (
                              self.prob_mat[x_in, y_in]
                              * self.pred_mat[:, :, a_out, b_out, x_in, y_in]
                          )
  
                  rho = cvxpy.Variable((dim_x, dim_y), hermitian=True)
  
                  objective = cvxpy.Maximize(cvxpy.real(cvxpy.trace(p_win.conj().T @ rho)))
  
                  constraints = [cvxpy.trace(rho) == 1, rho >> 0]
                  problem = cvxpy.Problem(objective, constraints)
                  unent_val = problem.solve()
                  max_unent_val = max(max_unent_val, unent_val)
          return max_unent_val
code_tokens: def unentangled_value ( self ) -> float : dim_x , dim_y , alice_out , bob_out , alice_in , bob_in = self . pred_mat . shape max_unent_val = float ( "-inf" ) for a_out in range ( alice_out ) : for b_out in range ( bob_out ) : p_win = np . zeros ( [ dim_x , dim_y ] , dtype = complex ) for x_in in range ( alice_in ) : for y_in in range ( bob_in ) : p_win += ( self . prob_mat [ x_in , y_in ] * self . pred_mat [ : , : , a_out , b_out , x_in , y_in ] ) rho = cvxpy . Variable ( ( dim_x , dim_y ) , hermitian = True ) objective = cvxpy . Maximize ( cvxpy . real ( cvxpy . trace ( p_win . conj ( ) . T @ rho ) ) ) constraints = [ cvxpy . trace ( rho ) == 1 , rho >> 0 ] problem = cvxpy . Problem ( objective , constraints ) unent_val = problem . solve ( ) max_unent_val = max ( max_unent_val , unent_val ) return max_unent_val
short_docstring: r"""
  Calculate the unentangled value of an extended nonlocal game.
short_docstring_tokens: r " " " Calculate the unentangled value of an extended nonlocal game .
comment: r"""
          Calculate the unentangled value of an extended nonlocal game.
  
          The *unentangled value* of an extended nonlocal game is the supremum
          value for Alice and Bob's winning probability in the game over all
          unentangled strategies. Due to convexity and compactness, it is possible
          to calculate the unentangled extended nonlocal game by:
  
          .. math::
              \omega(G) = \max_{f, g}
              \lVert
              \sum_{(x,y) \in \Sigma_A \times \Sigma_B} \pi(x,y)
              V(f(x), g(y)|x, y)
              \rVert
  
          where the maximum is over all functions :math:`f : \Sigma_A \rightarrow
          \Gamma_A` and :math:`g : \Sigma_B \rightarrow \Gamma_B`.
  
          :return: The unentangled value of the extended nonlocal game.
          """