function plasma_matrix_test02 ( n )

%*****************************************************************************80
%
%% plasma_matrix_test02() solves a plasma matrix linear system using bicg.
%
%  Discussion:
%
%    The use specifies a linear grid dimension of N, corresponding to N^2
%    grid points and N^4 matrix entries.  However, the actual matrix is
%    sparse, to only about 5*N^2 entries are nonzero.  
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 January 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the linear order of the spatial grid.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'plasma_matrix_test02():\n' );
  fprintf ( 1, '  Linear order of spatial grid = %d\n', n );
  fprintf ( 1, '  Number of grid points is %d\n', n * n );
  fprintf ( 1, '  Approximate number of nonzero matrix entries is %d.\n', 5 * n * n );
  fprintf ( 1, '  Full storage matrix would require %d entries.\n', n^4 );

  [ A, b ] = plasma_matrix ( n );
%
%  Use backslash to solve the system A * x = b.
%
  x1 = A \ b;
  x1_norm = norm ( x1 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of backslash solution is %g\n', x1_norm )
%
%  Use bicg to solve the system A * x = b.
%
  x2 = bicg ( A, b );
  x2_norm = norm ( x2 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of bicg solution is %g\n', x2_norm )
%
%  Use bicg+ilu to solve the system A * x = b.
%
  tol = 1.0E-06;
  itmax = 40;
  [ L, U ] = ilu ( A );
  x3 = bicg ( A, b, tol, itmax, L, U );
  x3_norm = norm ( x3 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of bicg+ilu solution is %g\n', x3_norm )

  return
end
