示例#1
0
 def __mul__(self, other):
     """The product of two expressions.
     """
     # Cannot multiply two non-constant expressions.
     if not self.is_constant() and \
        not other.is_constant():
         raise TypeError("Cannot multiply two non-constants.")
     # The constant term must always be on the left.
     elif not self.is_constant():
         # If other is a scalar, simply move it left.
         if other.is_scalar():
             return types.mul_expr()(other, self)
         else:
             return (other.T * self.T).T
     else:
         return types.mul_expr()(self, other)
示例#2
0
 def __mul__(self, other):
     """The product of two expressions.
     """
     # Cannot multiply two non-constant expressions.
     if not self.is_constant() and \
        not other.is_constant():
         raise TypeError("Cannot multiply two non-constants.")
     # The constant term must always be on the left.
     elif not self.is_constant():
         # If other is a scalar, simply move it left.
         if other.is_scalar():
             return types.mul_expr()(other, self)
         else:
             return (other.T * self.T).T
     else:
         return types.mul_expr()(self, other)
示例#3
0
 def __mul__(self, other):
     """The product of two expressions.
     """
     # Cannot multiply two non-constant expressions.
     if not self.is_constant() and \
        not other.is_constant():
         # TODO replace with special exception.
         raise Exception("Cannot multiply two non-constants.")
     # The constant term must always be on the left.
     elif not self.is_constant():
         return (other.T * self.T).T
     else:
         return types.mul_expr()(self, other)
示例#4
0
 def __mul__(self, other):
     """The product of two expressions.
     """
     # Cannot multiply two non-constant expressions.
     if not self.is_constant() and \
        not other.is_constant():
         # TODO replace with special exception.
         raise Exception("Cannot multiply two non-constants.")
     # The constant term must always be on the left.
     elif not self.is_constant():
         return (other.T * self.T).T
     else:
         return types.mul_expr()(self, other)
示例#5
0
 def __mul__(self, other):
     """The product of two expressions.
     """
     # Cannot multiply two non-constant expressions.
     if not self.is_constant() and \
        not other.is_constant():
         raise TypeError("Cannot multiply two non-constants.")
     # Multiplying by a constant on the right is handled differently
     # from multiplying by a constant on the left.
     elif not self.is_constant():
         return types.rmul_expr()(self, other)
     else:
         return types.mul_expr()(self, other)
示例#6
0
 def __mul__(self, other):
     # Cannot multiply two non-constant expressions.
     if not self.curvature.is_constant() and \
        not other.curvature.is_constant():
         raise Exception("Cannot multiply two non-constants.")
     return types.mul_expr()(self, other)