function nnz = mm_nnz_set ( rep, symm, nrow, ncol )

%*****************************************************************************80
%
%% mm_nnz_set() sets the value of NNZ for the ARRAY representation.
%
%  Discussion:
%
%    If the representation is not "ARRAY", then NNZ is returned as 0.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 April 2004
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    character REP, the Matrix Market 'representation'
%    indicator.  Possible values include:
%    'coordinate'   (for sparse data)
%    'array'        (for dense data)
%    'elemental'    (to be added)
%
%    character SYMM, the Matrix Market symmetry.
%    Possible values include:
%    'symmetric'
%    'hermitian'
%    'skew-symmetric'
%    'general'
%
%    integer NROW, the number of rows in the matrix.
%
%    integer NCOL, the number of columns in the matrix.
%
%  Output:
%
%    integer NNZ, the number of nonzero entries required to store
%    the matrix.
%
  nnz = 0;
  
  if ( s_eqi ( rep, 'coordinate' ) )

  elseif ( s_eqi ( rep, 'array' ) )

    if ( s_eqi ( symm, 'general' ) )
      nnz = nrow * ncol;
    elseif ( s_eqi ( symm, 'symmetric' ) || s_eqi ( symm, 'hermitian' ) )
      nnz = floor ( ( nrow * ncol - nrow ) / 2 ) + nrow;
    elseif ( s_eqi ( symm, 'skew-symmetric' ) )
      nnz = floor ( ( nrow * ncol - nrow ) / 2 );
    end

  end

  return
end
