print_matrix Subroutine

private subroutine print_matrix(mat, format_type)

print a matrix in a given format

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: mat(:,:)
character(len=*), intent(in), optional :: format_type

Calls

proc~~print_matrix~~CallsGraph proc~print_matrix print_matrix proc~print_matrix_in_format print_matrix_in_format proc~print_matrix->proc~print_matrix_in_format proc~print_plain_matrix print_plain_matrix proc~print_matrix->proc~print_plain_matrix

Called by

proc~~print_matrix~~CalledByGraph proc~print_matrix print_matrix interface~print_array print_array interface~print_array->proc~print_matrix

Variables

Type Visibility Attributes Name Initial
character(len=20), private :: format_selected

Source Code

   subroutine print_matrix(mat, format_type)
    !! print a matrix in a given format
      real(kind=dp), intent(in) :: mat(:, :)  ! 2D array
      character(len=*), intent(in), optional :: format_type
      character(len=20) :: format_selected
      ! Determine the format: default to "PLAIN" if not specified
      if (present(format_type)) then
         format_selected = trim(adjustl(format_type))
      else
         format_selected = "PLAIN"
      end if
      ! Handle plain format separately or delegate to print routine based on the format
      if (format_selected == "PLAIN") then
         call print_plain_matrix(mat)
      else
         call print_matrix_in_format(mat, format_selected)
      end if
   end subroutine print_matrix