function r8crs_print_some ( n, nz, row, col, val, ilo, jlo, ihi, jhi, title )

%*****************************************************************************80
%
%% r8crs_print_some() prints some of a R8CRS matrix.
%
%  Discussion:
%
%    The R8CRS storage format stores the nonzero entries of row I in 
%    entries ROW(I) through ROW(I+1)-1 of VAL.  
%    COL(J) records the column index of the entry in VAL(J).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of the matrix.
%
%    integer NZ, the number of nonzero elements.
%
%    integer ROW(N+1).  The nonzero offdiagonal elements 
%    of row I of A are contained in A(ROW(I)) through A(ROW(I+1)-1).
%
%    integer COL(NZ), the column indices of the nonzero elements of A.
%
%    real VAL(NZ), the nonzero elements of A.
%
%    integer ILO, JLO, IHI, JHI, the first row and
%    column, and the last row and column to be printed.
%
%    string TITLE, a title.
%
  if ( 0 < length ( title ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, '%s\n', title );
  end

  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, n );

    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 = row(i) : row(i+1)-1
          if ( j == col(k) )
            aij = val(k);
          end
        end

        fprintf ( 1, '%12g  ', aij );

      end

      fprintf ( 1, '\n' );

    end

  end

  return
end
