Beispiel #1
0
def inverse(x):
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("inverse", inverse) (x)
    assert hasattr(x,'invert') and hasattr(x,'copy')
    cop = x.copy() 
    cop.invert()
    return cop
Beispiel #2
0
def inverse(x):
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("inverse", inverse)(x)
    assert hasattr(x, 'invert') and hasattr(x, 'copy')
    cop = x.copy()
    cop.invert()
    return cop
Beispiel #3
0
    def __mul__(self, arg):

        if descriptors.is_lazy(arg):
          return lazy_expressions.make_lazy(self) * arg
        else:
          res = self.copy()
          res *= arg
          return res
Beispiel #4
0
    def __mul__(self, arg):

        if descriptors.is_lazy(arg):
          return lazy_expressions.make_lazy(self) * arg
        else:
          res = self.copy()
          res *= arg
          return res
Beispiel #5
0
def inverse(x):
    """
    Return the inverse of a Green's function
    """
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("inverse", inverse) (x)
    assert hasattr(x,'inverse')
    return x.inverse()
Beispiel #6
0
def conjugate(x):
    """
    Return the conjugate of a Green's function
    """
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("conjugate", conjugate) (x)
    assert hasattr(x,'conjugate')
    return x.conjugate()
Beispiel #7
0
def transpose(x):
    """
    Return the transpose of a Green's function
    """
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("transpose", transpose) (x)
    assert hasattr(x,'transpose')
    return x.transpose()
Beispiel #8
0
def inverse(x):
    """
    Compute the inverse of a Green's function and return this.
    """
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("inverse", inverse)(x)
    assert hasattr(x, 'invert') and hasattr(x, 'copy')
    cop = x.copy()
    cop.invert()
    return cop
Beispiel #9
0
 def __idiv__(self, arg):
     """ If arg is a scalar, simple scalar multiplication
     """
     if descriptors.is_lazy(arg): return lazy_expressions.make_lazy(self) / arg
     if descriptors.is_scalar(arg):
         self.data /= arg
         self.tail /= arg
     else:
         raise RuntimeError, " argument type not recognized in imul for %s"%arg
     return self
Beispiel #10
0
 def __idiv__(self, arg):
     """ If arg is a scalar, simple scalar multiplication
     """
     if descriptors.is_lazy(arg): return lazy_expressions.make_lazy(self) / arg
     if descriptors.is_scalar(arg):
         self.data /= arg
         self.tail /= arg
     else:
         raise RuntimeError, " argument type not recognized in imul for %s"%arg
     return self
Beispiel #11
0
def inverse(x):
    """
    Compute the inverse of a Green's function and return this.
    """
    if descriptors.is_lazy(x):
        return lazy_expressions.lazy_function("inverse", inverse)(x)
    assert hasattr(x, "invert") and hasattr(x, "copy")
    cop = x.copy()
    cop.invert()
    return cop
Beispiel #12
0
 def __sub__(self, y):
     if descriptors.is_lazy(y): return lazy_expressions.make_lazy(self) - y
     c = self.copy()
     return self.__sub_isub_impl(c,y,True)
Beispiel #13
0
    def __rmul__(self, arg):

        if descriptors.is_lazy(arg):
          return arg * lazy_expressions.make_lazy(self)
        elif descriptors.is_scalar(arg):
          return self.__mul__(arg)
Beispiel #14
0
 def __sub__(self, y):
     if descriptors.is_lazy(y): return lazy_expressions.make_lazy(self) - y
     c = self.copy()
     return self.__sub_isub_impl(c,y,True)
Beispiel #15
0
    def __rmul__(self, arg):

        if descriptors.is_lazy(arg):
          return arg * lazy_expressions.make_lazy(self)
        elif descriptors.is_scalar(arg):
          return self.__mul__(arg)
Beispiel #16
0
 def __sub__(self, y):
     if descriptors.is_lazy(y): return lazy_expressions.make_lazy(self) - y
     c = self.copy()
     c -= y
     return c
Beispiel #17
0
 def __add__(self, y):
     if descriptors.is_lazy(y): return lazy_expressions.make_lazy(self) + y
     c = self.copy()
     c += y
     return c