function van_der_corput_write ( n, seed, base, r, file_out_name ) %% VAN_DER_CORPUT_WRITE writes a van der Corput dataset to a file. % % Discussion: % % The initial lines of the file are comments, which begin with a % '#' character. % % Thereafter, each line of the file contains the NDIM-dimensional % components of the next entry in the dataset. % % Modified: % % 16 April 2005 % % Author: % % John Burkardt % % Parameters: % % Input, integer N, the number of elements in the subsequence. % % Input, integer SEED, the seed for the random number generator. % % Input, integer BASE, the base. % % Input, real R(N), the points. % % Input, string FILE_OUT_NAME, the name of the output file. % file_out_unit = fopen ( file_out_name, 'w' ); if ( file_out_unit < 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'VAN_DER_CORPUT_WRITE - Fatal error!\n' ); fprintf ( 1, ' Could not open the output file:\n' ); fprintf ( 1, ' "%s".\n', file_out_name ); error ( 'VAN_DER_CORPUT_WRITE - Fatal error!' ); end today = timestring; fprintf ( file_out_unit, '# %s\n', file_out_name ); fprintf ( file_out_unit, '# created by VAN_DER_CORPUT_WRITE.M\n' ); fprintf ( file_out_unit, '#\n' ); fprintf ( file_out_unit, '# File generated on %s\n', timestring ); fprintf ( file_out_unit, '#\n' ); fprintf ( file_out_unit, '# N = %d\n', n ); fprintf ( file_out_unit, '# SEED = %d\n', seed ); fprintf ( file_out_unit, '# BASE = %d\n', base ); fprintf ( file_out_unit, '# EPSILON (unit roundoff ) = %e\n', ... r8_epsilon ( 'DUMMY' ) ); fprintf ( file_out_unit, '#\n' ); for i = 1 : n fprintf ( file_out_unit, ' %10f', r(i) ); fprintf ( file_out_unit, '\n' ); end fclose ( file_out_unit );