function a = anticirculant_inverse ( n, x )

%*****************************************************************************80
%
%% anticirculant_inverse() returns the inverse of the ANTICIRCULANT matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%    real X(N), the values that define the anticirculant matrix.
%
%  Output:
%
%    real A(N,N), the matrix.
%

%
%  Compute the inverse of the CIRCULANT matrix.
%
  lambda = circulant_eigenvalues ( n, x );

  b = zeros ( n, n );

  for i = 1 : n
    if ( lambda(i) ~= 0.0 )
      b(i,i) = 1.0 / conj ( lambda(i) );
    end
  end

  f = fourier_matrix ( n );

  a(1:n,1:n) = real ( f' * b * f );
%
%  Transform this into the inverse of the ANTICIRCULANT matrix.
%
  e = exchange_matrix ( n, n );
  e = [ e(n,:); e(1:n-1,:) ];
  a = a * e;

  return
end
