function A = minij(n)
%MINIJ  Symmetric positive definite matrix MIN(i,j).
%   A = GALLERY('MINIJ',N) is the N-by-N symmetric positive definite 
%   matrix with A(i,j) = MIN(i,j).
%
%   Properties:
%   INV(A) is tridiagonal. It is minus the second difference matrix
%     except its (N,N) element is 1.
%   2*A-ONES(SIZE(A)) (Givens' matrix) has tridiagonal inverse and
%     eigenvalues 0.5*sec((2*r-1)*pi/(4*N))^2, r = 1:N.
%   (N+1)*ONES(A)-A has elements MAX(i,j) and a tridiagonal inverse.

%   References:
%   [1] J. Todd, Basic Numerical Mathematics, Vol 2: Numerical Algebra,
%       Birkhauser, Basel, and Academic Press, New York, 1977, p. 158.
%   [2] D.E. Rutherford, Some continuant determinants arising in 
%       physics and chemistry---II, Proc. Royal Soc. Edin., 63, 
%       A (1952), pp. 232-241. (For the eigenvalues of Givens' matrix.)
%
%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.6 $  $Date: 1997/11/21 23:29:48 $

A = min( ones(n,1)*(1:n), (1:n)'*ones(1,n) );
