function a = loewner_matrix ( w, x, y, z, n )

%*****************************************************************************80
%
%% loewner_matrix returns the LOEWNER matrix.
%
%  Formula:
%
%    A(I,J) = ( W(I) - X(J) ) / ( Y(I) - Z(J) )
%
%  Example:
%
%    N = 3
%    W = (/ 8, 4, 9 /)
%    X = (/ 1, 2, 3 /)
%    Y = (/ 9, 6, 4 /)
%    Z = (/ 2, 3, 1 /)
%
%    A =
%
%    8 - 1  8 - 2  8 - 3
%    -----  -----  -----
%    9 - 2  9 - 3  9 - 1
%
%    4 - 1  4 - 2  4 - 3
%    -----  -----  -----
%    6 - 2  6 - 3  6 - 1
%
%    9 - 1  9 - 2  9 - 3
%    -----  -----  -----
%    4 - 2  4 - 3  4 - 1
%
%    =
%
%    7/7  6/6  5/8
%
%    3/4  2/3  1/5
%
%    8/2  7/1  6/3
%
%  Properties:
%
%    A is generally not symmetric: A' /= A.
%
%    The family of matrices is nested as a function of N.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 October 2007
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real W(N), X(N), Y(N), Z(N), vectors defining the matrix.
%
%    integer N, the order of A.
%
%  Output:
%
%    real A(N,N), the matrix.
%
  a = zeros ( n, n );

  for i = 1 : n
    for j = 1 : n

      if ( y(i) - z(j) == 0.0 )
        fprintf ( 1, '\n' );
        fprintf ( 1, 'loewner_matrix - Fatal error!\n' );
        fprintf ( 1, '  Y(I) = Z(J).\n' );
        error ( 'loewner_matrix - Fatal error!' );
      end

      a(i,j) = ( w(i) - x(j) ) / ( y(i) - z(j) );

    end
  end

  return
end
