function linpack_z_test08 ( )

%*****************************************************************************80
%
%% test08 tests zgefa and zgesl.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 June 2009
%
%  Author:
%
%    John Burkardt
%
  n = 3;
  lda = n;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TEST08\n' );
  fprintf ( 1, '  For a complex general storage matrix:\n' );
  fprintf ( 1, '  ZGEFA factors the matrix.\n' );
  fprintf ( 1, '  ZGESL solves a linear system.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  The matrix order is N = %d\n', n );
%
%  Set the values of the matrix A.
%
  a = crand ( n, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The matrix:\n' );
  fprintf ( 1, '\n' );

  for i = 1 : n
    for j = 1 : n
      fprintf ( 1, '  (%8f  %8f)', real ( a(i,j) ), imag ( a(i,j) ) );
    end
    fprintf ( 1, '\n' );
  end
%
%  Set the values of the right hand side vector B.
%
  x = crand ( n );

  b(1:n,1) = a(1:n,1:n) * x(1:n,1);

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The right hand side:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  (%8f  %8f)\n', real ( b(i,1) ), imag ( b(i,1) ) );
  end
%
%  Factor the matrix A.
%
  [ a, ipvt, info ] = zgefa ( a, lda, n );

  if ( info ~= 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, '  ZGEFA returned an error flag INFO = %d\n', info );
    return
  end
%
%  Solve the system.
%
  job = 0;
  b(1:n,1) = zgesl ( a, lda, n, ipvt, b, job );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Computed                     Exact\n' );
  fprintf ( 1, '  Solution                     Solution\n' );
  fprintf ( 1, '\n' );

  for i = 1 : n
    fprintf ( 1, '  (%12f  %12f)  (%12f  %12f)\n', ...
      real ( b(i,1) ), imag ( b(i,1) ), real ( x(i,1) ), imag ( x(i,1) ) );
  end

  return
end
