program main c*********************************************************************72 c cc test_lls_test() tests test_lls(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 07 September 2012 c c Author: c c John Burkardt c implicit none call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test_lls_test():' write ( *, '(a)' ) ' Fortran77 version' write ( *, '(a)' ) ' Test test_lls().' call test01 ( ) c c Terminate. c write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test_lls_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop end subroutine test01 ( ) c*********************************************************************72 c cc TEST01 summarizes the test data. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 07 September 2012 c c Author: c c John Burkardt c implicit none integer m_max parameter ( m_max = 10 ) integer n_max parameter ( n_max = 10 ) double precision a(m_max,n_max) double precision b(m_max) double precision b_norm integer i integer m integer n integer prob integer prob_num double precision r(m_max) double precision r_norm double precision r8vec_norm double precision x(n_max) double precision x_norm write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST01' write ( *, '(a)' ) & ' Get each least squares test, compute the maximum residual.' write ( *, '(a)' ) & ' The L2 norm of the residual MUST be no greater than the' write ( *, '(a)' ) & ' L2 norm of the right hand side, else 0 is a better solution.' call p00_prob_num ( prob_num ) write ( *, '(a)' ) ' ' write ( *, '(a,i4)' ) ' Number of problems = ', prob_num write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' Index M N ||B|| ||X|| ||R||' write ( *, '(a)' ) ' ' do prob = 1, prob_num call p00_m ( prob, m ) call p00_n ( prob, n ) call p00_a ( prob, m, n, a ) call p00_b ( prob, m, b ) call p00_x ( prob, n, x ) call r8mat_mv ( m, n, a, x, r ) do i = 1, m r(i) = r(i) - b(i) end do b_norm = r8vec_norm ( m, b ) x_norm = r8vec_norm ( n, x ) r_norm = r8vec_norm ( m, r ) write ( *, '(2x,i5,2x,i4,2x,i4,2x,g12.4,2x,g12.4,2x,g12.4)' ) & prob, m, n, b_norm, x_norm, r_norm end do return end subroutine timestamp ( ) c*********************************************************************72 c cc timestamp() prints the YMDHMS date as a timestamp. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 12 June 2014 c c Author: c c John Burkardt c implicit none character * ( 8 ) ampm integer d character * ( 8 ) date integer h integer m integer mm character * ( 9 ) month(12) integer n integer s character * ( 10 ) time integer y save month data month / & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' / call date_and_time ( date, time ) read ( date, '(i4,i2,i2)' ) y, m, d read ( time, '(i2,i2,i2,1x,i3)' ) h, n, s, mm if ( h .lt. 12 ) then ampm = 'AM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h .lt. 12 ) then ampm = 'PM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, & '(i2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) & d, trim ( month(m) ), y, h, ':', n, ':', s, '.', mm, & trim ( ampm ) return end