示例#1
0
def triul(tridmat):
    '''
    Get the UL decomposition for tridiagonal matrix, A=UL

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

    *return*:
        A <TLUSystem> instance with order 'UL'.
    '''
    al=tridmat.lower
    bl=tridmat.diagonal
    cl=tridmat.upper
    ll,ul,hl,invhl=get_tlu_seq(al=al,bl=bl,cl=cl,which='>')
    return TLUSystem(ll=ul,ul=ll,hl=hl,invhl=invhl,order='UL')
示例#2
0
def triul(tridmat):
    '''
    Get the UL decomposition for tridiagonal matrix, A=UL

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

    *return*:
        A <TLUSystem> instance with order 'UL'.
    '''
    al = tridmat.lower
    bl = tridmat.diagonal
    cl = tridmat.upper
    ll, ul, hl, invhl = get_tlu_seq(al=al, bl=bl, cl=cl, which='>')
    return TLUSystem(ll=ul, ul=ll, hl=hl, invhl=invhl, order='UL')
示例#3
0
def trilu(tridmat):
    '''
    Get the LU decomposition for tridiagonal matrix, A=LU

    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 'LU'.
    '''
    al=tridmat.lower
    bl=tridmat.diagonal
    cl=tridmat.upper
    is_scalar=tridmat.is_scalar
    ll,ul,hl,invhl=get_tlu_seq(al=al,bl=bl,cl=cl,which='<')
    return TLUSystem(ll=ll,ul=ul,hl=hl,invhl=invhl,order='LU')
示例#4
0
def trilu(tridmat):
    '''
    Get the LU decomposition for tridiagonal matrix, A=LU

    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 'LU'.
    '''
    al = tridmat.lower
    bl = tridmat.diagonal
    cl = tridmat.upper
    is_scalar = tridmat.is_scalar
    ll, ul, hl, invhl = get_tlu_seq(al=al, bl=bl, cl=cl, which='<')
    return TLUSystem(ll=ll, ul=ul, hl=hl, invhl=invhl, order='LU')
示例#5
0
def get_inv_system(tridmat):
    '''
    Get the inversion generator for tridiagonal matrix.
    The Fortran version and python version are provided for block tridiagonal matrix.

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

    Reference -> http://dx.doi.org/10.1016/j.amc.2005.11.098

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

    *return*:
        a <BTInvSystem> instance.
    '''
    ll1,ll2,ll3,ul1,ul2,ul3,hl1,hl2,hl3,invhl1,invhl2,invhl3=get_tlu_seq(al=tridmat.lower,bl=tridmat.diagonal,cl=tridmat.upper)
    return BTInvSystem((ll1,hl1,ul1,invhl1),(ll2,hl2,ul2,invhl2),(ll3,hl3,ul3,invhl3))
示例#6
0
def get_inv_system(tridmat):
    '''
    Get the inversion generator for tridiagonal matrix.
    The Fortran version and python version are provided for block tridiagonal matrix.

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

    Reference -> http://dx.doi.org/10.1016/j.amc.2005.11.098

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

    *return*:
        a <BTInvSystem> instance.
    '''
    ll1, ll2, ll3, ul1, ul2, ul3, hl1, hl2, hl3, invhl1, invhl2, invhl3 = get_tlu_seq(
        al=tridmat.lower, bl=tridmat.diagonal, cl=tridmat.upper)
    return BTInvSystem((ll1, hl1, ul1, invhl1), (ll2, hl2, ul2, invhl2),
                       (ll3, hl3, ul3, invhl3))