Пример #1
0
def Set_to_zero_unb_var1(A):
    """
	Set_to_zero_unb_var1(matrix)	
	
	Sets the input matrix to zeros.
	Traverses input matrix from LEFT to RIGHT
	and sets results column-wise.
    """

    AL, \
    AR = flame.part_1x2(A, \
                        0, 'LEFT')

    while AL.shape[1] < A.shape[1]:

        A0, \
        a1, \
        A2 = flame.repart_1x2_to_1x3(AL, \
                                     AR, \
                                     1, 'RIGHT')

        laff.zerov(a1)

        AL, \
        AR = flame.cont_with_1x3_to_1x2(A0, \
                                        a1, \
                                        A2, 'LEFT')

    flame.merge_1x2(AL, \
                    AR, A)
Пример #2
0
def Set_to_zero_unb_var1(A):
    """
	Set_to_zero_unb_var1(matrix)	
	
	Sets the input matrix to zeros.
	Traverses input matrix from LEFT to RIGHT
	and sets results column-wise.
    """

    AL, \
    AR = flame.part_1x2(A, \
                        0, 'LEFT')

    while AL.shape[1] < A.shape[1]:

        A0, \
        a1, \
        A2 = flame.repart_1x2_to_1x3(AL, \
                                     AR, \
                                     1, 'RIGHT')

        laff.zerov(a1)

        AL, \
        AR = flame.cont_with_1x3_to_1x2(A0, \
                                        a1, \
                                        A2, 'LEFT')

    flame.merge_1x2(AL, \
                    AR, A)
Пример #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)
Пример #4
0
def trsm_lutu(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')

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

        trsv('Upper triangular', 'Transpose', 'Unit diagonal', U, b1)

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

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

    flame.merge_1x2(BL, BR, B)
Пример #5
0
def trsm_llnu(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')

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

        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)
Пример #6
0
def trsm_llnn(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')

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

        trsv( 'Lower triangular', 'No transpose', 'Nonunit diagonal', L, b1 )

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

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

    flame.merge_1x2(BL, BR, B)
Пример #7
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)
Пример #8
0
def Transpose_unb_var2(A, B):
    """
	Transpose_unb_var1(matrix, matrix)	
	
	Transposes matrix A and stores result in matrix B.

	Traverses matrix A from TOP to BOTTOM,
	matrix B from LEFT to RIGHT,
	and copies rows of A to columns of B.
    """
    AT, \
    AB  = flame.part_2x1(A, \
                         0, 'TOP')

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

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

        A0,  \
        a1t, \
        A2   = flame.repart_2x1_to_3x1(AT, \
                                       AB, \
                                       1, 'BOTTOM')

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

        laff.copy( a1t, b1 )
        
        AT, \
        AB  = flame.cont_with_3x1_to_2x1(A0,  \
                                         a1t, \
                                         A2,  \
                                         'TOP')

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

    flame.merge_1x2(BL, BR, B)
Пример #9
0
def Scale_a_matrix_unb_var1(beta, A):
    """
	Scale_a_matrix_unb_var1(scalar, matrix)	
	
	Scales matrix A by a factor of beta.

	Traverses matrix A from LEFT to RIGHT.
    """
    AL, AR = flame.part_1x2(A, \
                            0, 'LEFT')

    while AL.shape[1] < A.shape[1]:

        A0, a1, A2 = flame.repart_1x2_to_1x3(AL, AR, \
                                             1, 'RIGHT')

        laff.scal(beta,a1)

        AL, AR = flame.cont_with_1x3_to_1x2(A0, a1, A2, \
                                            'LEFT')

    flame.merge_1x2(AL, AR, A)