def __mul__(self, other): """Expression : The product of two expressions. """ if self.is_scalar() or other.is_scalar(): return cvxtypes.multiply_expr()(self, other) elif self.is_constant() or other.is_constant(): return cvxtypes.mul_expr()(self, other) else: warnings.warn("Forming a nonconvex expression.") return cvxtypes.mul_expr()(self, other)
def __mul__(self, other): """Expression : The product of two expressions. """ if self.shape == () or other.shape == () or \ (self.shape[-1] != other.shape[0] and (self.is_scalar() or other.is_scalar())): return cvxtypes.multiply_expr()(self, other) elif self.is_constant() or other.is_constant(): return cvxtypes.mul_expr()(self, other) else: if error.warnings_enabled(): warnings.warn("Forming a nonconvex expression.") return cvxtypes.mul_expr()(self, other)