function [ A_out, p_out ] = LUpiv_right_looking( A )

  [ m, n ] = size( A );
  p = zeros( n, 1 );
  
  [ ATL, ATR, ...
    ABL, ABR ] = FLA_Part_2x2( A, ...
                               0, 0, 'FLA_TL' );

  [ pT, ...
    pB ] = FLA_Part_2x1( p, ...
                         0, 'FLA_TOP' );

  while ( size( ATL, 1 ) < size( A, 1 ) )

    [ A00,  a01,     A02,  ...
      a10t, alpha11, a12t, ...
      A20,  a21,     A22 ] = FLA_Repart_2x2_to_3x3( ATL, ATR, ...
                                                    ABL, ABR, ...
                                                    1, 1, 'FLA_BR' );

    [ p0, ...
      pi1, ...
      p2 ] = FLA_Repart_2x1_to_3x1( pT, ...
                                    pB, ...
                                    1, 'FLA_BOTTOM' );

    %------------------------------------------------------------%

    pi1 = maxi( [ alpha11 
                   a21 ] );
    [ a10t, alpha11, a12t, ...
      A20,  a21,     A22 ] = Swap( pi1, a10t, alpha11, a12t, ...
                                         A20,    a21,   A22 );      
    a21 = a21 / alpha11;
    A22 = A22 - a21 * a12t;

    %------------------------------------------------------------%

    [ ATL, ATR, ...
      ABL, ABR ] = FLA_Cont_with_3x3_to_2x2( A00,  a01,     A02,  ...
                                             a10t, alpha11, a12t, ...
                                             A20,  a21,     A22, ...
                                             'FLA_TL' );

    [ pT, ...
      pB ] = FLA_Cont_with_3x1_to_2x1( p0, ...
                                       pi1, ...
                                       p2, ...
                                       'FLA_TOP' );

  end

  A_out = [ ATL, ATR
            ABL, ABR ];

  p_out = [ pT
            pB ];

return