function table_quality ( input_filename )
%% TABLE_QUALITY determines quality measures for a given set of points.
%
% Discussion:
%
% This version is set up to handle datasets in the unit hypercube.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 08 November 2005
%
% Author:
%
% John Burkardt
%
% Reference:
%
% Max Gunzburger, John Burkardt,
% Uniformity Measures for Point Samples in Hypercubes.
%
% Local parameters:
%
% Local, integer NDIM, the spatial dimension of the point set.
%
% Local, integer N, the number of points.
%
% Local, real Z(NDIM,N), the point set.
%
% Local, integer NS, the number of sample points.
%
ns = 100000;
seed_init = 123456789;
fprintf ( 1, '\n' );
timestamp ( );
fprintf ( 1, '\n' );
fprintf ( 1, 'TABLE_QUALITY:\n' );
fprintf ( 1, ' MATLAB version:\n' );
fprintf ( 1, ' Compute measures of uniform dispersion for a pointset.\n' );
fprintf ( 1, '\n' );
fprintf ( 1, ' Note: this routine assumes that the input pointset\n' );
fprintf ( 1, ' is contained in the unit hypercube. If this is not\n' );
fprintf ( 1, ' the case, then you must rewrite the routine\n' );
fprintf ( 1, ' SAMPLE_ROUTINE\n' );
fprintf ( 1, ' so that it properly returns sample points in your\n' );
fprintf ( 1, ' region, with a uniform density, or a probability\n' );
fprintf ( 1, ' density of your choosing.\n' );
if ( s_len_trim ( input_filename ) <= 0 )
fprintf ( 1, '\n' );
input_filename = input ( 'Enter the name of the input file.' );
end
[ ndim, n ] = dtable_header_read ( input_filename );
%
% Read the point set.
%
z = dtable_data_read ( input_filename );
fprintf ( 1, '\n' );
fprintf ( 1, 'TABLE_QUALITY:\n' );
fprintf ( 1, ' Measures of uniform point dispersion.\n' );
fprintf ( 1, '\n' );
fprintf ( 1, ' The pointset was read from "%s"\n', input_filename );
fprintf ( 1, '\n' );
fprintf ( 1, ' The sampling routine is "SAMPLE_HYPERCUBE_UNIFORM".\n' );
fprintf ( 1, '\n' );
fprintf ( 1, ' The spatial dimension NDIM = %12d\n', ndim );
fprintf ( 1, ' The number of points N = %12d\n', n );
fprintf ( 1, ' The number of sample points NS = %12d\n', ns );
fprintf ( 1, ' The random number SEED_INIT = %12d\n', seed_init );
fprintf ( 1, '\n' );
%
% For 2 dimensional datasets, some quality measures work from the Delaunay triangulation.
% Compute that here.
%
if ( ndim == 2 )
triangle = delaunay ( z(1,1:n), z(2,1:n) );
triangle = triangle';
[ dummy, nt ] = size ( triangle );
else
triangle = [];
nt = 0;
end
if ( ndim == 2 )
fprintf ( 1, ' The minimum angle measure Alpha = %14f\n', ...
alpha_measure ( n, z, nt, triangle ) );
fprintf ( 1, ' The area ratio measure Area = %14f\n', ...
area_measure ( n, z, nt, triangle ) );
else
fprintf ( 1, ' The minimum angle measure Alpha = (omitted)\n' );
fprintf ( 1, ' The area ratio measure Area = (omitted)\n', ...
end
fprintf ( 1, ' Relative spacing deviation BETA = %14f\n', ...
lambda_measure ( ndim, n, z ) );
fprintf ( 1, ' The regularity measure Chi = %14f\n', ...
chi_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
fprintf ( 1, ' 2nd moment determinant measure D = %14e\n', ...
d_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
fprintf ( 1, ' The Voronoi energy measure E = %14f\n', ...
e_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
fprintf ( 1, ' The mesh ratio Gamma = %14f\n', ...
gamma_measure ( ndim, n, z ) );
fprintf ( 1, ' The point distribution norm H = %14f\n', ...
h_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
fprintf ( 1, ' The COV measure Lambda = %14f\n', ...
lambda_measure ( ndim, n, z ) );
fprintf ( 1, ' The point distribution ratio Mu = %14f\n', ...
mu_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
fprintf ( 1, ' The cell volume deviation Nu = %14f\n', ...
nu_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
if ( ndim == 2 )
fprintf ( 1, ' The triangle uniformity measure Q = %14f\n', ...
q_measure ( n, z, nt, triangle ) );
else
fprintf ( 1, ' The triangle uniformity measure Q = (omitted)\n' );
end
fprintf ( 1, ' The Riesz S = 0 energy measure R0 = %14f\n', ...
r0_measure ( ndim, n, z ) );
if ( dmat_in_01 ( ndim, n, z ) )
fprintf ( 1, ' Nonintersecting sphere volume S = %14f\n', ...
sphere_measure ( ndim, n, z ) );
else
fprintf ( 1, ' Nonintersecting sphere volume S = (omitted)\n' );
end
fprintf ( 1, ' 2nd moment trace measure Tau = %14f\n', ...
tau_measure ( ndim, n, z, ns, 'sample_hypercube_uniform', seed_init ) );
gamma = pointset_spacing ( dim_num, n, z );
gamma_min = min ( gamma(1:n) );
gamma_max = max ( gamma(1:n) );
gamma_ave = sum ( gamma(1:n) ) / n;
if ( 1 < n )
gamma_std = sqrt ( sum ( ( gamma(1:n) - gamma_ave ).^2 ) / ( n - 1 ) );
else
gamma_std = 0.0;
end
fprintf ( 1, '\n');
fprintf ( 1, ' Minimum spacing GAMMA_MIN = %f\n', gamma_min );
fprintf ( 1, ' Average spacing GAMMA_AVE = %f\n', gamma_ave );
fprintf ( 1, ' Maximum spacing GAMMA_MAX = %f\n', gamma_max );
fprintf ( 1, ' Spacing standard dev GAMMA_STD = %f\n', gamma_std );
fprintf ( 1, '\n' );
fprintf ( 1, 'TABLE_QUALITY:\n' );
fprintf ( 1, ' Normal end of execution.\n' );
fprintf ( 1, '\n' );
timestamp ( );
return
end