!___________________________________________________________________________________________________ ! Aleksandar Donev ! PHY201 Solutions to Worksheet ! December, 2000, MSU !___________________________________________________________________________________________________ ! PROGRAM Erf_Time USE Precision USE Erf_Series, ONLY: error USE Erf_Timing IMPLICIT NONE ! ! We are in position to choose whether we want REAL or COMPLEX x: ! Comment one of these out: INTEGER :: i, k, status, n_points ! I/O status REAL (KIND=wp) :: x REAL (KIND=sp) :: elapsed_time ! The timing result REAL (KIND=wp), PARAMETER :: x_min = 0.0, x_max = 4.5 ! Range of plot ! UserInput: DO WRITE (UNIT=*, FMT="(A)", ADVANCE="NO") "Enter: n_points and error: " READ (UNIT=*, FMT=*, IOSTAT=STATUS) n_points, error IF (status == 0) EXIT UserInput ! Do not exit until the user enters acceptable numbers END DO UserInput ! DO i = 1, n_points x = REAL (i-1, wp) / REAL (n_points-1, wp) * (x_max-x_min) + x_min elapsed_time = TimeErf (x) WRITE (UNIT=*, FMT="(A,G10.3,A,G10.2,A)") "x=", x, " time=", elapsed_time, " us" END DO ! END PROGRAM Erf_Time !