% Copyright 2003, 2004 The University of Texas at Austin
%
% For licensing information see
%                http://www.cs.utexas.edu/users/flame/license.html 
%                                                                                 
% Programmed by: Name of author
%                Email of author

function [B_out ] = Trsm_blk_var1( L, B, nb_alg )

  [ LTL, LTR, ...
    LBL, LBR ] = FLA_Part_2x2( L, ...
	                       0, 0, 'FLA_TL' );

  [ BT, ...
    BB ] = FLA_Part_2x1( B, ...
                         0, 'FLA_TOP' );

  while ( size( LTL, 1 ) ~= size( L, 1 ) )

    b = min( size( LBR, 1 ), nb_alg );

    [ L00, L01, L02, ...
      L10, L11, L12, ...
      L20, L21, L22 ] = FLA_Repart_2x2_to_3x3( LTL, LTR, ...
                                                LBL, LBR, ...
                                                b, b, 'FLA_BR' );

    [ B0, ...
      B1, ...
      B2 ] = FLA_Repart_2x1_to_3x1( BT, ...
	                            BB, ...
				    b, 'FLA_BOTTOM' );

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

     B1 = B1 - L10 * B0;
     B1 = L11 \ B1; 

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

    [ LTL, LTR, ...
      LBL, LBR ] = FLA_Cont_with_3x3_to_2x2( L00, L01, L02, ...
	                                     L10, L11, L12, ...
					     L20, L21, L22, ...
					    'FLA_TL' );

    [ BT, ...
      BB ] = FLA_Cont_with_3x1_to_2x1( B0, ...
	                               B1, ...
                                       B2, ...
                                       'FLA_TOP' );

  end

  B_out = [ BT
            BB ];

return
