function [ row, col, val, nz, n ] = crs_read ( prefix )

%*****************************************************************************80
%
%% crs_read() reads data about a sparse matrix in CRS format.
%
%  Discussion:
%
%    Three files are presumed to exist:
%    * prefix_row.txt contains N+1 row start values;
%    * prefix_col.txt contains NZ column indices;
%    * prefix_val.txt contains NZ matrix entries
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 June 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string PREFIX, a common prefix for the filenames.
%
%  Output:
%
%    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 NZ, the number of elements.
%
%    integer N, the number of columns in the matrix.
%
  filename_row = strcat ( prefix, '_row.txt' );
  row = load ( filename_row );

  filename_col = strcat ( prefix, '_col.txt' );
  col = load ( filename_col );

  filename_val = strcat ( prefix, '_val.txt' );
  val = load ( filename_val );

  nz = length ( col );
  n = length ( row ) - 1;

  return
end
