Print a 3D tensor of values
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | matrix(:,:,:) | |||
| character(len=*), | intent(in), | optional | :: | format_type | ||
| type(error_t), | intent(inout), | optional | :: | err |
set to ERROR_VALIDATION for an unsupported format_type; the tensor is printed with NumPy brackets regardless |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=20), | private | :: | print_format |
subroutine print_3d_tensor_int64(matrix, format_type, err) !! Print a 3D tensor of ${T} values integer(int64), intent(in) :: matrix(:, :, :) character(len=*), intent(in), optional :: format_type type(error_t), intent(inout), optional :: err !! set to ERROR_VALIDATION for an unsupported format_type; the tensor !! 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(int32) :: k, rows, cols, depth rows = size(matrix, 1) cols = size(matrix, 2) depth = size(matrix, 3) call set_brackets(print_format, open_bracket, close_bracket, err) print *, open_bracket do k = 1, depth if (k > 1) print *, "," print *, open_bracket call pic_print_array(matrix(:, :, k), print_format, err) print *, close_bracket end do print *, close_bracket end block print end subroutine print_3d_tensor_int64