Пример #1
0
def get_invh_system(tridmat):
    '''
    Get the inversion generator for `hermitian` tridiagonal matrix.
    The Fortran version and python version are provided for block tridiagonal matrix.

    The complexity of this procedure is N.
    However, if you're going to generate the whole inversion elements through STInvSystem instance,
    the complexity is N^2.

    Reference -> http://dx.doi.org/10.1137/0613045

    trdmat:
        A tridiagonal matrix, i.g. an instance of TridMatrix.

    *return*:
        A STInvSystem instance.
    '''
    if tridmat.is_scalar:
        du,invdu=get_dl(al=tridmat.lower,bl=tridmat.diagonal,cl=tridmat.upper,order='UDL')
        dl,invdl=get_dl(al=tridmat.lower,bl=tridmat.diagonal,cl=tridmat.upper,order='LDU')
        u,v=get_uv(invdu=invdu,invdl=invdl,al=tridmat.lower,cl=tridmat.upper)
        res=STInvSystem(u,v)
        return res
    else:
        raise Exception('Not Implemented For block tridiagonal matrices!')
Пример #2
0
def get_invh_system(tridmat):
    '''
    Get the inversion generator for `hermitian` tridiagonal matrix.
    The Fortran version and python version are provided for block tridiagonal matrix.

    The complexity of this procedure is N.
    However, if you're going to generate the whole inversion elements through STInvSystem instance,
    the complexity is N^2.

    Reference -> http://dx.doi.org/10.1137/0613045

    trdmat:
        A tridiagonal matrix, i.g. an instance of TridMatrix.

    *return*:
        A STInvSystem instance.
    '''
    if tridmat.is_scalar:
        du, invdu = get_dl(al=tridmat.lower,
                           bl=tridmat.diagonal,
                           cl=tridmat.upper,
                           order='UDL')
        dl, invdl = get_dl(al=tridmat.lower,
                           bl=tridmat.diagonal,
                           cl=tridmat.upper,
                           order='LDU')
        u, v = get_uv(invdu=invdu,
                      invdl=invdl,
                      al=tridmat.lower,
                      cl=tridmat.upper)
        res = STInvSystem(u, v)
        return res
    else:
        raise Exception('Not Implemented For block tridiagonal matrices!')
Пример #3
0
def triudl(tridmat):
    '''
    Get the UDL decomposition, A=UD^{-1}U^\dag

    The complexity of this procedure is n*p^3.

    tridmat:
        The tridiagonal matrix.

    *return*:
        A <TLUSystem> instance with order 'UDL'.
    '''
    dl,invdl=get_dl(al=tridmat.lower,bl=tridmat.diagonal,cl=tridmat.upper,order='UDL')
    return TLUSystem(hl=dl,invhl=invdl,ll=tridmat.lower,ul=tridmat.upper,order='UDL')
Пример #4
0
def trildu(tridmat):
    '''
    Get the LDU decomposition, A=LD^{-1}L^\dag

    The complexity of this procedure is n*p^3.

    trdmat:
        A tridiagonal matrix, i.g. an instance of TridMatrix.

    *return*:
        A <TLUSystem> instance with order 'LDU'.
    '''
    dl,invdl=get_dl(al=tridmat.lower,bl=tridmat.diagonal,cl=tridmat.upper,order='LDU')
    res=TLUSystem(hl=dl,invhl=invdl,ll=tridmat.lower,ul=tridmat.upper,order='LDU')
    return res
Пример #5
0
def triudl(tridmat):
    '''
    Get the UDL decomposition, A=UD^{-1}U^\dag

    The complexity of this procedure is n*p^3.

    tridmat:
        The tridiagonal matrix.

    *return*:
        A <TLUSystem> instance with order 'UDL'.
    '''
    dl, invdl = get_dl(al=tridmat.lower,
                       bl=tridmat.diagonal,
                       cl=tridmat.upper,
                       order='UDL')
    return TLUSystem(hl=dl,
                     invhl=invdl,
                     ll=tridmat.lower,
                     ul=tridmat.upper,
                     order='UDL')
Пример #6
0
def trildu(tridmat):
    '''
    Get the LDU decomposition, A=LD^{-1}L^\dag

    The complexity of this procedure is n*p^3.

    trdmat:
        A tridiagonal matrix, i.g. an instance of TridMatrix.

    *return*:
        A <TLUSystem> instance with order 'LDU'.
    '''
    dl, invdl = get_dl(al=tridmat.lower,
                       bl=tridmat.diagonal,
                       cl=tridmat.upper,
                       order='LDU')
    res = TLUSystem(hl=dl,
                    invhl=invdl,
                    ll=tridmat.lower,
                    ul=tridmat.upper,
                    order='LDU')
    return res