1% 2% 3% Copyright (C) 2014, The University of Texas at Austin 4% 5% This file is part of libflame and is available under the 3-Clause 6% BSD license, which can be found in the LICENSE file at the top-level 7% directory, or at http://opensource.org/licenses/BSD-3-Clause 8% 9% 10 function [ A00, A01, A02,... 11 A10, A11, A12,... 12 A20, A21, A22 ] = FLA_Repart_2x2_to_3x3( ATL, ATR,... 13 ABL, ABR,... 14 bm, bn, quadrant ) 15% 16% function [ A00, A01, A02,... 17% A10, A11, A12,... 18% A20, A21, A22 ] = FLA_Repart_2x2_to_3x3( ATL, ATR,... 19% ABL, ABR,... 20% bm, bn, quadrant ) 21% 22% Purpose: Repartition a 2 x 2 partitioning of matrix A into 23% a 3 x 3 partitioning where mb x nb submatrix A11 is split from 24% the quadrant indicated by quadrant 25% 26 [ mtl, ntl ] = size( ATL ); 27 [ mtr, ntr ] = size( ATR ); 28 [ mbl, nbl ] = size( ABL ); 29 [ mbr, nbr ] = size( ABR ); 30% 31% Check input parameters 32% 33 if( mtl ~= mtr ) 34 error('input matrices in top row must have the same number of rows'); 35 elseif( mbl ~= mbr ) 36 error('input matrices in bottom row must have the same number of rows'); 37 elseif( ntl ~= nbl ) 38 error('input matrices in left column must have the same number of columns'); 39 elseif( ntr ~= nbr ) 40 error('input matrices in right column must have the same number of columns'); 41 elseif( ( ~strcmp( quadrant(1:6), 'FLA_TL' ) )&... 42 ( ~strcmp( quadrant(1:6), 'FLA_TR' ) )&... 43 ( ~strcmp( quadrant(1:6), 'FLA_BL' ) )&... 44 ( ~strcmp( quadrant(1:6), 'FLA_BR' ) ) ) 45 error('quadrant must be a string with contents equal to FLA_TL, FLA_TR, FLA_BL, or FLA_BR'); 46 end 47% 48% Repartitioning... 49% 50 if( strcmp( quadrant(1:6), 'FLA_TL' ) ) 51 A00 = ATL( 1:mtl-bm, 1:ntl-bn ); 52 A01 = ATL( 1:mtl-bm, ntl-bn+1:ntl ); 53 A02 = ATR( 1:mtl-bm, : ); 54 A10 = ATL( mtl-bm+1:mtl, 1:ntl-bn ); 55 A11 = ATL( mtl-bm+1:mtl, ntl-bn+1:ntl ); 56 A12 = ATR( mtl-bm+1:mtl, : ); 57 A20 = ABL( :, 1:ntl-bn ); 58 A21 = ABL( :, ntl-bn+1:ntl ); 59 A22 = ABR; 60 elseif( strcmp( quadrant(1:6), 'FLA_TR' ) ) 61 A00 = ATL( 1:mtr-bm, : ); 62 A01 = ATR( 1:mtr-bm, 1:bn ); 63 A02 = ATR( 1:mtr-bm, bn+1:ntr ); 64 A10 = ATL( mtr-bm+1:mtr, : ); 65 A11 = ATR( mtr-bm+1:mtr, 1:bn ); 66 A12 = ATR( mtr-bm+1:mtr, bn+1:ntr ); 67 A20 = ABL; 68 A21 = ABR( :, 1:bn ); 69 A22 = ABR( :, bn+1:ntr ); 70 elseif( strcmp( quadrant(1:6), 'FLA_BL' ) ) 71 A00 = ATL( :, 1:nbl-bn ); 72 A01 = ATL( :, bn+1:nbl ); 73 A02 = ATR; 74 A10 = ABL( 1:bm, 1:nbl-bn ); 75 A11 = ABL( 1:bm, bn+1:nbl ); 76 A12 = ABR( 1:bm, : ); 77 A20 = ABL( bm+1:mbl, 1:nbl-bn ); 78 A21 = ABL( bm+1:mbl, bn+1:nbl ); 79 A22 = ABR( bm+1:mbl, : ); 80 else 81 A00 = ATL; 82 A01 = ATR( :, 1:bn ); 83 A02 = ATR( :, bn+1:nbr ); 84 A10 = ABL( 1:bm, : ); 85 A11 = ABR( 1:bm, 1:bn ); 86 A12 = ABR( 1:bm, bn+1:nbr ); 87 A20 = ABL( bm+1:mbr, : ); 88 A21 = ABR( bm+1:mbr, 1:bn ); 89 A22 = ABR( bm+1:mbr, bn+1:nbr ); 90 end 91% 92 return; 93% 94% End of FLA_Repart_2x2_to_3x3 95% 96