function r8cc_print_some ( m, n, nz_num, colptr, rowind, a, ilo, jlo, ihi, ... jhi, title ) %*****************************************************************************80 % %% R8CC_PRINT_SOME prints some of a R8CC matrix. % % Discussion: % % The R8CC format is the double precision sparse compressed column % format. Associated with this format, we have an M by N matrix % with NZ_NUM nonzero entries. We construct the column pointer % vector COL of length N+1, such that entries of column J will be % stored in positions COL(J) through COL(J+1)-1. This indexing % refers to both the ROW and A vectors, which store the row indices % and the values of the nonzero entries. The entries of the % ROW vector corresponding to each column are assumed to be % ascending sorted. % % The R8CC format is equivalent to the MATLAB "sparse" format, % and the Harwell Boeing "real unsymmetric assembled" (RUA) format. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 01 September 2006 % % Author: % % John Burkardt % % Reference: % % Iain Duff, Roger Grimes, John Lewis, % User's Guide for the Harwell-Boeing Sparse Matrix Collection, % October 1992 % % Parameters: % % Input, integer M, the number of rows of the matrix. % % Input, integer N, the number of columns of the matrix. % % Input, integer NZ_NUM, the number of nonzero elements in A. % % Input, integer COLPTR(N+1), points to the first element of each column. % % Input, integer ROWIND(NZ_NUM), contains the row indices of the elements. % % Input, real A(NZ_NUM), the matrix. % % Input, integer ILO, JLO, IHI, JHI, 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 ); i2hi = min ( ihi, m ); for i = i2lo : i2hi fprintf ( 1, '%4d ', i ); % % Print out (up to) 5 entries in row I, that lie in the current strip. % for j = j2lo : j2hi aij = 0.0; for k = colptr(j) : colptr(j+1)-1 if ( rowind(k) == i ) aij = a(k); break; end end fprintf ( 1, '%12f ', aij ); end fprintf ( 1, '\n' ); end end fprintf ( 1, '\n' ); return end