예제 #1
0
파일: kron.py 프로젝트: rileyjmurray/cvxpy
 def is_atom_convex(self) -> bool:
     """Is the atom convex?
     """
     if u.scopes.dpp_scope_active():
         # kron is not DPP if any parameters are present.
         x = self.args[0]
         y = self.args[1]
         return ((x.is_constant() or y.is_constant())
                 and (is_param_free(x) and is_param_free(y)))
     else:
         return self.args[0].is_constant() or self.args[1].is_constant()
예제 #2
0
 def is_atom_convex(self):
     """Multiplication is convex (affine) in its arguments only if one of
        the arguments is constant.
     """
     if u.scopes.dpp_scope_active():
         # This branch applies curvature rules for DPP.
         #
         # Because a DPP scope is active, parameters will be
         # treated as affine (like variables, not constants) by curvature
         # analysis methods.
         #
         # Like under DCP, a product x * y is convex if x or y is constant.
         # If neither x nor y is constant, then the product is DPP
         # if one of the expressions is affine in its parameters and the
         # other is parameter-free.
         x = self.args[0]
         y = self.args[1]
         return ((x.is_constant() or y.is_constant())
                 or (is_param_affine(x) and is_param_free(y))
                 or (is_param_affine(y) and is_param_free(x)))
     else:
         return self.args[0].is_constant() or self.args[1].is_constant()