print a vector of values
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=sp), | intent(in) | :: | vector(:) | |||
| character(len=*), | intent(in), | optional | :: | format_type | ||
| type(error_t), | intent(inout), | optional | :: | err |
set to ERROR_VALIDATION for an unsupported format_type; the vector is printed with NumPy brackets regardless |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=20), | private | :: | print_format |
subroutine print_vector_sp(vector, format_type, err) !! print a vector of ${T} values real(sp), intent(in) :: vector(:) character(len=*), intent(in), optional :: format_type type(error_t), intent(inout), optional :: err !! set to ERROR_VALIDATION for an unsupported format_type; the vector !! is printed with NumPy brackets regardless character(len=20) :: print_format print_format = pic_optional(format_type, default_format) print: block character(len=1) :: open_bracket, close_bracket integer(default_int) :: i, loop_bound_i loop_bound_i = size(vector) call set_brackets(print_format, open_bracket, close_bracket, err) write (*, "(A)", advance="no") open_bracket do i = 1, loop_bound_i if (i == loop_bound_i) then ! Last element in the vector write (*, fmt_edge, advance="no") to_char(vector(i)) else ! Elements in between write (*, fmt_in, advance="no") to_char(vector(i)) end if end do print *, close_bracket end block print end subroutine print_vector_sp