function [ locate, d ] = test_partial_digest ( k, dmax )

%*****************************************************************************80
%
%% test_partial_digest() returns a partial digest test problem.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 January 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer K, the number of objects.
%    K must be at least 2.
%
%    integer DMAX, the maximum possible distance.
%    DMAX must be at least K-1.
%
%  Output:
%
%    integer LOCATE(K), the obect locations.
%
%    integer D(K*(K-1)/2), the pairwise distances.
%

%
%  Check input.
%
  if ( k < 2 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TEST_PARTIAL_DIGEST - Fatal error!\n' );
    fprintf ( 1, '  Input K < 2.\n' );
    error ( 'TEST_PARTIAL_DIGEST - Fatal error!' );
  end

  if ( dmax < k - 1 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TEST_PARTIAL_DIGEST - Fatal error!\n' );
    fprintf ( 1, '  DMAX < K - 1.\n' );
    error ( 'TEST_PARTIAL_DIGEST - Fatal error!' );
  end
%
%  Select LOCATE, which is a random subset of the integers 0 through DMAX.
%
  locate = ksub_random ( dmax - 1, k - 2 );
  locate = [ 0; locate; dmax ];
%
%  Compute K*(K+1)/2 pairwise distances.
%
  d = i4vec_distances ( k, locate );
 
  return
end
