program main !*****************************************************************************80 ! !! MAIN is the main program for SOBOL_DATASET. ! ! Discussion: ! ! SOBOL_DATASET generates a Sobol dataset and writes it to a file. ! ! Licensing: ! ! This code is distributed under the GNU LGPL license. ! ! Modified: ! ! 03 August 2004 ! ! Author: ! ! John Burkardt ! implicit none character ( len = 80 ) :: file_out_name integer ios integer ( kind = 8 ) m integer ( kind = 8 ) n real ( kind = 8 ), allocatable, dimension ( :, : ) :: r integer ( kind = 8 ) skip call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'SOBOL_DATASET' write ( *, '(a)' ) ' FORTRAN90 version.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Generate a Sobol quasirandom dataset.' do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Enter M, the spatial dimension:' write ( *, '(a)' ) ' (0 or any negative value terminates execution).' read ( *, *, iostat = ios ) m if ( ios /= 0 ) then exit end if if ( m <= 0 ) then exit end if write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Enter N, the number of points to generate:' write ( *, '(a)' ) ' (0 or any negative value terminates execution).' read ( *, *, iostat = ios ) n if ( ios /= 0 ) then exit end if if ( n <= 0 ) then exit end if write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Enter SKIP, the number of initial points to skip:' write ( *, '(a)' ) ' (0 is a common choice).' write ( *, '(a)' ) ' (Another is the least power of 2 greater than' write ( *, '(a)' ) ' or equal to N.)' write ( *, '(a)' ) ' (a negative value terminates execution.)' read ( *, *, iostat = ios ) skip if ( ios /= 0 ) then exit end if if ( skip < 0 ) then exit end if allocate ( r(1:m,1:n) ) call i8_sobol_generate ( m, n, skip, r ) write ( file_out_name, '(a,i2.2,a,i5.5,a)' ) 'sobol_', m, '_', n, '.txt' call i8_sobol_write ( m, n, skip, r, file_out_name ) deallocate ( r ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' The Sobol data was written to the file "' & // trim ( file_out_name ) // '".' end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'SOBOL_DATASET' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop end