function det = r8ci_det ( n, a )

%*****************************************************************************80
%
%% R8CI_DET returns the determinant of an R8CI matrix.
%
%  Discussion:
%
%    The R8CI storage format is used for an N by N circulant matrix.
%    An N by N circulant matrix A has the property that the entries on
%    row I appear again on row I+1, shifted one position to the right,
%    with the final entry of row I appearing as the first of row I+1.
%    The format simply records the first row of the matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 June 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the order of the matrix.
%
%    Input, real A(N), the R8CI matrix.
%
%    Output, real DET, the determinant.
%
  w(1:n) = c8vec_unity ( n );

  lambda(1:n) = a(n);

  for i = n-1 : -1 : 1
    lambda(1:n) = lambda(1:n) .* w(1:n) + a(i);
  end

  det = prod ( lambda(1:n) );
%
%  DET should be real, but let's get rid of any tiny complex bit.
%
  det = real ( det );

  return
end
