예제 #1
0
def _v4c_isub_(s, other):
    """Decrement 4-vector with other 4-vector
    >>> p4  = ...
    >>> p4 -= other 
    """
    s.SetE(COMPLEX(s.E() - other.E()))
    s.SetPx(COMPLEX(s.Px() - other.Px()))
    s.SetPy(COMPLEX(s.Py() - other.Py()))
    s.SetPz(COMPLEX(s.Pz() - other.Pz()))
    return s
예제 #2
0
def _v4c_iadd_(s, other):
    """Increment 4-vector with other 4-vector
    >>> p4  = ...
    >>> p4 += other 
    """
    s.SetE(COMPLEX(s.E() + other.E()))
    s.SetPx(COMPLEX(s.Px() + other.Px()))
    s.SetPy(COMPLEX(s.Py() + other.Py()))
    s.SetPz(COMPLEX(s.Pz() + other.Pz()))
    return s
예제 #3
0
def _v4c_init_(self, *args):
    """Construct  complex lorenzt vector from another vector or from coordinates
    >>> v4  = ...
    >>> lv  = ComplexLorenztVector ( v4 )
    >>> lv1 = ComplexLorenztVector () 
    >>> lv2 = ComplexLorenztVector ( 1    ) 
    >>> lv3 = ComplexLorenztVector ( 1+2j ) 
    >>> lv4 = ComplexLorenztVector ( 1,  2, 3, 4 ) 
    >>> lv5 = ComplexLorenztVector ( 1,  2, 3, 4+3j ) 
    """
    if args and 1 == len(args):
        a = args[0]
        if isinstance(a, V4C): return V4C._old_init_(self, a)
        elif isinstance(a, V4D):
            return V4C._old_init_(self, COMPLEX(a.X()), COMPLEX(a.Y()),
                                  COMPLEX(a.Z()), COMPLEX(a.T()))

    assert len(args) <= 4, 'Invalid  argument length!'
    ac = [COMPLEX(i) for i in args]
    while len(ac) < 4:
        ac.append(COMPLEX())
    return V4C._old_init_(self, *ac)