function r8gb_print_some ( m, n, ml, mu, a, ilo, jlo, ihi, jhi, title ) %*****************************************************************************80 % %% R8GB_PRINT_SOME prints some of a banded matrix. % % Discussion: % % An M by N banded matrix A with lower bandwidth ML and upper bandwidth MU % is assumed to be entirely zero, except for the main diagonal, and % entries in the ML nearest subdiagonals, and MU nearest superdiagonals. % % LINPACK and LAPACK "R8GB" storage for such a matrix generally includes % room for ML extra superdiagonals, which may be required to store % nonzero entries generated during Gaussian elimination. % % The original M by N matrix is "collapsed" downward, so that diagonals % become rows of the storage array, while columns are preserved. The % collapsed array is logically 2*ML+MU+1 by N. % % Only entries in rows ILO to IHI, columns JLO to JHI are considered. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 07 April 2006 % % Author: % % John Burkardt % % Parameters: % % Input, integer M, the number of rows of the matrix. % M must be positive. % % Input, integer N, the number of columns of the matrix. % N must be positive. % % Input, integer ML, MU, the lower and upper bandwidths. % ML and MU must be nonnegative, and no greater than min(M,N)-1.. % % Input, real A(2*ML+MU+1,N), the M by N band matrix, stored in LINPACK % or LAPACK general band storage mode. % % Input, integer ILO, JLO, IHI, JHI, designate the first row and % column, and the last row and column to be printed. % % Input, string TITLE, a title. % fprintf ( 1, '\n' ); fprintf ( 1, '%s\n', title ); incx = 5; % % Print the columns of the matrix, in strips of 5. % for j2lo = jlo : incx : jhi j2hi = j2lo + incx - 1; j2hi = min ( j2hi, n ); j2hi = min ( j2hi, jhi ); inc = j2hi + 1 - j2lo; fprintf ( 1, '\n' ); fprintf ( 1, ' Col: ' ); for j = j2lo : j2hi fprintf ( 1, '%7d ', j ); end fprintf ( 1, '\n' ); fprintf ( 1, ' Row\n' ); fprintf ( 1, ' ---\n' ); % % Determine the range of the rows in this strip. % i2lo = max ( ilo, 1 ); i2lo = max ( i2lo, j2lo - mu - ml ); i2hi = min ( ihi, m ); i2hi = min ( i2hi, j2hi + ml ); for i = i2lo : i2hi % % Print out (up to) 5 entries in row I, that lie in the current strip. % fprintf ( 1, '%6i ', i ); for j = j2lo: j2hi if ( i < j - mu - ml | j + ml < i ) fprintf ( 1, ' ' ); else fprintf ( 1, '%14f', a(i-j+ml+mu+1,j) ); end end fprintf ( 1, '\n' ); end end fprintf ( 1, '\n' ); return end