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.")
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.")
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))
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))