Example #1
0
 def cast_to_const(expr):
     """Converts a non-Expression to a Constant.
     """
     return expr if isinstance(expr, Expression) else types.constant()(expr)
Example #2
0
 def cast_to_const(expr):
     """Converts a non-Expression to a Constant.
     """
     return expr if isinstance(expr, Expression) else types.constant()(expr)
Example #3
0
 def __neg__(self):
     lh_mult = deque([types.constant()(-1)])
     terms = AffObjective.mul_terms([lh_mult], self._terms)
     return AffObjective(self.variables(), terms, self._shape)
Example #4
0
 def promote(obj, shape):
     ones = types.constant()(intf.DEFAULT_INTERFACE.ones(*shape.size))
     ones_obj,dummy = ones.canonical_form()
     return ones_obj*obj
Example #5
0
 def cast_to_const(expr):
     return expr if isinstance(expr, Expression) else types.constant()(expr)