Ejemplo n.º 1
0
def trsm_ltu(L, B):

    BT, \
    BB  = flame.part_2x1(B, \
                         0, 'TOP')

    while BT.shape[0] < B.shape[0]:

        B0,  \
        b1t, \
        B2   = flame.repart_2x1_to_3x1(BT, \
                                       BB, \
                                       1, 'BOTTOM')

        #------------------------------------------------------------#

        #TODO: Fix trsv.py to handle rows properly
        #Sorry for the hackiness in the fix here, I got pressed for time
        laff.trsv( 'Lower triangular', 'Transpose', 'Unit diagonal', L, transpose( b1t ) )

        #------------------------------------------------------------#

        BT, \
        BB  = flame.cont_with_3x1_to_2x1(B0,  \
                                         b1t, \
                                         B2,  \
                                         'TOP')

    flame.merge_2x1(BT, \
                    BB, B)
Ejemplo n.º 2
0
def trsm_utn(U, B):

    BT, \
    BB  = flame.part_2x1(B, \
                         0, 'TOP')

    while BT.shape[0] < B.shape[0]:

        B0,  \
        b1t, \
        B2   = flame.repart_2x1_to_3x1(BT, \
                                       BB, \
                                       1, 'BOTTOM')

        #------------------------------------------------------------#

        #TODO: Fix trsv.py to handle rows properly
        #Sorry for the hackiness in the fix here, I got pressed for time
        laff.trsv('Upper triangular', 'Transpose', 'Nonunit diagonal', U,
                  transpose(b1t))

        #------------------------------------------------------------#

        BT, \
        BB  = flame.cont_with_3x1_to_2x1(B0,  \
                                         b1t, \
                                         B2,  \
                                         'TOP')

    flame.merge_2x1(BT, \
                    BB, B)
Ejemplo n.º 3
0
def trsm_lnu(L, B):

    BL, BR = flame.part_1x2(B, 0, "LEFT")

    while BL.shape[1] < B.shape[1]:

        B0, b1, B2 = flame.repart_1x2_to_1x3(BL, BR, 1, "RIGHT")

        # ------------------------------------------------------------#

        laff.trsv("Lower triangular", "No transpose", "Unit diagonal", L, b1)

        # ------------------------------------------------------------#

        BL, BR = flame.cont_with_1x3_to_1x2(B0, b1, B2, "LEFT")

    flame.merge_1x2(BL, BR, B)
Ejemplo n.º 4
0
def trsm_unn(U, B):

    BL, BR = flame.part_1x2(B, \
                            0, 'LEFT')

    while BL.shape[1] < B.shape[1]:

        B0, b1, B2 = flame.repart_1x2_to_1x3(BL, BR, \
                                             1, 'RIGHT')

        #------------------------------------------------------------#

        laff.trsv('Upper triangular', 'No transpose', 'Nonunit diagonal', U, b1)

        #------------------------------------------------------------#

        BL, BR = flame.cont_with_1x3_to_1x2(B0, b1, B2, \
                                            'LEFT')

    flame.merge_1x2(BL, BR, B)
Ejemplo n.º 5
0
def trsm_lnu(L, B):

    BL, BR = flame.part_1x2(B, \
                            0, 'LEFT')

    while BL.shape[1] < B.shape[1]:

        B0, b1, B2 = flame.repart_1x2_to_1x3(BL, BR, \
                                             1, 'RIGHT')

        #------------------------------------------------------------#

        laff.trsv('Lower triangular', 'No transpose', 'Unit diagonal', L, b1)

        #------------------------------------------------------------#

        BL, BR = flame.cont_with_1x3_to_1x2(B0, b1, B2, \
                                            'LEFT')

    flame.merge_1x2(BL, BR, B)
Ejemplo n.º 6
0
def chol_unb(A):

    ATL, ATR, \
    ABL, ABR  = flame.part_2x2(A, \
                               0, 0, 'TL')

    while ATL.shape[0] < A.shape[0]:

        A00,  a01,     A02,  \
        a10t, alpha11, a12t, \
        A20,  a21,     A22   = flame.repart_2x2_to_3x3(ATL, ATR, \
                                                       ABL, ABR, \
                                                       1, 1, 'BR')

        #------------------------------------------------------------#

        # alpha11[0,0] = np.sqrt( alpha11[0,0] )
        # laff.invscal( alpha11, a21 )
        # laff.ger( -1, a21, a21, A22 ) #Not tril

        # laff.dots( a10t, a10t, alpha11 )
        # alpha11[0,0] = np.sqrt( alpha11[0,0] )
        # a21 -= A20 * np.transpose(a10t) #Not laff calls
        # laff.invscal( alpha11, a21 )

        laff.trsv( 'Lower triangular', 'Nonunit diagonal', 'No transpose', A00, a10t )
        laff.dots( a10t, a10t, alpha11 )
        alpha11[0,0] = np.sqrt( alpha11[0,0] )

        #------------------------------------------------------------#

        ATL, ATR, \
        ABL, ABR  = flame.cont_with_3x3_to_2x2(A00,  a01,     A02,  \
                                               a10t, alpha11, a12t, \
                                               A20,  a21,     A22,  \
                                               'TL')

    flame.merge_2x2(ATL, ATR, \
                    ABL, ABR, A)