program main c*********************************************************************72 c cc chebyshev_interp_1d_test() tests chebyshev_interp_1d(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 14 October 2012 c c Author: c c John Burkardt c implicit none integer prob integer prob_num call timestamp ( ) write ( *, '(a)' ) '' write ( *, '(a)' ) 'chebyshev_interp_1d_test():' write ( *, '(a)' ) ' FORTRAN77 version' write ( *, '(a)' ) ' Test chebyshev_interp_1d().' write ( *, '(a)' ) & ' The QR_SOLVE and R8LIB libraries are needed.' write ( *, '(a)' ) & ' The test needs the TEST_INTERP library as well.' call p00_prob_num ( prob_num ) do prob = 1, prob_num call test01 ( prob ) end do c c Terminate. c write ( *, '(a)' ) '' write ( *, '(a)' ) 'chebyshev_interp_1d_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) '' call timestamp ( ) return end subroutine test01 ( prob ) c*********************************************************************72 c cc TEST01 tests CHEBYSHEV_VALUE_1D. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 20 September 2012 c c Author: c c John Burkardt c implicit none integer nd_max parameter ( nd_max = 49 ) integer i double precision int_error integer nd integer ni integer prob double precision r8vec_norm_affine double precision xd(nd_max) double precision xi(nd_max) double precision xy(2,nd_max) double precision yd(nd_max) double precision yi(nd_max) write ( *, '(a)' ) '' write ( *, '(a)' ) 'CHEBYSHEV_INTERP_1D_TEST01:' write ( *, '(a,i6)' ) & ' Interpolate data from TEST_INTERP problem #', prob call p00_data_num ( prob, nd ) write ( *, '(a,i6)' ) ' Number of data points = ', nd call p00_data ( prob, 2, nd, xy ) call r8mat_transpose_print ( 2, nd, xy, ' Data array:' ) do i = 1, nd xd(i) = xy(1,i) yd(i) = xy(2,i) end do c c #1: Does interpolant match function at interpolation points? c ni = nd do i = 1, ni xi(i) = xd(i) end do call chebyshev_interp_1d ( nd, xd, yd, ni, xi, yi ) int_error = r8vec_norm_affine ( ni, yi, yd ) / dble ( ni ) write ( *, '(a)' ) '' write ( *, '(a,g14.6)' ) & ' L2 interpolation error averaged per interpolant node = ', & int_error return end subroutine r8mat_transpose_print ( m, n, a, title ) c*********************************************************************72 c cc r8mat_transpose_print() prints an R8MAT, transposed. c c Discussion: c c An R8MAT is an array of R8's. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 April 2008 c c Author: c c John Burkardt c c Parameters: c c Input, integer M, N, the number of rows and columns. c c Input, double precision A(M,N), an M by N matrix to be printed. c c Input, character*(*) TITLE, a title. c implicit none integer m integer n double precision a(m,n) character*(*) title call r8mat_transpose_print_some ( m, n, a, 1, 1, m, n, title ) return end subroutine r8mat_transpose_print_some ( m, n, a, ilo, jlo, ihi, & jhi, title ) c*********************************************************************72 c cc r8mat_transpose_print_some() prints some of an R8MAT transposed. c c Discussion: c c An R8MAT is an array of R8's. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 April 2008 c c Author: c c John Burkardt c c Parameters: c c Input, integer M, N, the number of rows and columns. c c Input, double precision A(M,N), an M by N matrix to be printed. c c Input, integer ILO, JLO, the first row and column to print. c c Input, integer IHI, JHI, the last row and column to print. c c Input, character * ( * ) TITLE, a title. c implicit none integer incx parameter ( incx = 5 ) integer m integer n double precision a(m,n) character * ( 14 ) ctemp(incx) integer i integer i2 integer i2hi integer i2lo integer ihi integer ilo integer inc integer j integer j2hi integer j2lo integer jhi integer jlo character * ( * ) title write ( *, '(a)' ) ' ' write ( *, '(a)' ) trim ( title ) if ( m .le. 0 .or. n .le. 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' (None)' return end if do i2lo = max ( ilo, 1 ), min ( ihi, m ), incx i2hi = i2lo + incx - 1 i2hi = min ( i2hi, m ) i2hi = min ( i2hi, ihi ) inc = i2hi + 1 - i2lo write ( *, '(a)' ) ' ' do i = i2lo, i2hi i2 = i + 1 - i2lo write ( ctemp(i2), '(i8,6x)') i end do write ( *, '('' Row'',5a14)' ) ctemp(1:inc) write ( *, '(a)' ) ' Col' j2lo = max ( jlo, 1 ) j2hi = min ( jhi, n ) do j = j2lo, j2hi do i2 = 1, inc i = i2lo - 1 + i2 write ( ctemp(i2), '(g14.6)' ) a(i,j) end do write ( *, '(2x,i8,a,5a14)' ) j, ':', ( ctemp(i), i = 1, inc ) end do end do return end function r8vec_min ( n, a ) c*********************************************************************72 c cc r8vec_min() returns the minimum value in an R8VEC. c c Discussion: c c An R8VEC is a vector of R8's. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 January 2015 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the number of entries in the array. c c Input, double precision A(N), the array. c c Output, double precision R8VEC_MIN, the value of the smallest entry. c implicit none integer n double precision a(n) integer i double precision r8_huge parameter ( r8_huge = 1.79769313486231571D+308 ) double precision r8vec_min double precision value value = r8_huge do i = 1, n value = min ( value, a(i) ) end do r8vec_min = value return end