function b = symmetric_random_inverse ( n, d, key )

%*****************************************************************************80
%
%% symmetric_random_inverse(): inverse of the symmetric_random matrix.
%
%  Discussion:
%
%    For the inverse to exist, no entry of D may be zero.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of the matrix.
%
%    real D(N), the desired eigenvalues for the matrix.
%
%    integer KEY, a positive integer that selects the data.
%
%  Output:
%
%    real B(N,N), the matrix.
%

%
%  Get a random orthogonal matrix Q.
%
  q = orthogonal_random_matrix ( n, key );
%
%  Set B = Q * 1/Lambda * Q'.
%
  l_inv = diag ( 1.0 ./ d );

  b = q * l_inv * q';

  return
end
