#NEWLINE# def _upper2lower( ub ) : #NEWLINE# #INDENT# '\n    Convert upper triangular banded matrix to lower banded form.\n\n    INPUTS:\n       ub  -- an upper triangular banded matrix\n\n    OUTPUTS: lb\n       lb  -- a lower triangular banded matrix with same entries\n              as ub\n    ' #NEWLINE# lb = np . zeros ( ub . shape , ub . dtype ) #NEWLINE# ( nrow , ncol ) = ub . shape #NEWLINE# for i in range ( ub . shape [ 0 ] ) : #NEWLINE# #INDENT# lb [ i , 0 : ( ncol - i ) ] = ub [ ( ( nrow - 1 ) - i ) , i : ncol ] #NEWLINE# lb [ ncol , ( ncol - i ) : ] = ub [ ( ( nrow - 1 ) - i ) , 0 : i ] #NEWLINE# #UNINDENT# return lb