print_vector Subroutine

public subroutine print_vector(iunit, vector, ncols, name)

this subroutine prints the double precision vector named vector. elements 1 thru ncols will be printed. name is a character variable that describes vector. note that if name is given in the call to print_vector, it must be enclosed in quotes. if there are more than 10 elements in vector, 10 elements will be printed on each line.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iunit
real(kind=wp), intent(in), dimension(ncols) :: vector
integer, intent(in) :: ncols
character(len=*), intent(in) :: name

Called by

proc~~print_vector~~CalledByGraph proc~print_vector simulated_annealing_module::print_vector proc~sa simulated_annealing_module::simulated_annealing_type%sa proc~sa->proc~print_vector

Source Code

    subroutine print_vector(iunit, vector, ncols, name)

    implicit none

    integer, intent(in)                     :: iunit
    integer, intent(in)                     :: ncols
    real(wp), dimension(ncols), intent(in)  :: vector
    character(len=*), intent(in)            :: name

    integer :: i, lines, ll

    write(iunit,'(/,25X,A)') trim(name)

    if (ncols > 10) then
        lines = int(ncols/10.0_wp)
        do i = 1, lines
            ll = 10*(i - 1)
            write(iunit,'(10(G12.5,1X))') vector(1+ll:10+ll)
        end do
        write(iunit,'(10(G12.5,1X))') vector(11+ll:ncols)
    else
        write(iunit,'(10(G12.5,1X))') vector(1:ncols)
    end if

    end subroutine print_vector