def __div__(self, other):
     """Expression : One expression divided by another.
     """
     # Can only divide by scalar constants.
     if other.is_constant() and other.is_scalar():
         return cvxtypes.div_expr()(self, other)
     else:
         raise DCPError("Can only divide by a scalar constant.")
コード例 #2
0
ファイル: expression.py プロジェクト: nicaiseeric/cvxpy
 def __div__(self, other):
     """One expression divided by another.
     """
     # Can only divide by scalar constants.
     if other.is_constant() and other.is_scalar():
         return cvxtypes.div_expr()(self, other)
     else:
         raise DCPError("Can only divide by a scalar constant.")
コード例 #3
0
 def __div__(self, other):
     """Expression : One expression divided by another.
     """
     self, other = self.broadcast(self, other)
     if (self.is_scalar() or other.is_scalar()) or other.shape == self.shape:
         return cvxtypes.div_expr()(self, other)
     else:
         raise ValueError("Incompatible shapes for division (%s / %s)" % (
                          self.shape, other.shape))
コード例 #4
0
ファイル: expression.py プロジェクト: wanglinxuan2000/cvxpy
 def __div__(self, other):
     """Expression : One expression divided by another.
     """
     if (self.is_scalar() or other.is_scalar()) or other.shape == self.shape:
         if error.warnings_enabled():
             warnings.warn("Forming a nonconvex expression.")
         return cvxtypes.div_expr()(self, other)
     else:
         raise ValueError("Incompatible shapes for division (%s / %s)" % (
                          self.shape, other.shape))