tensor_range_m.f90 Source File


This file depends on

sourcefile~~tensor_range_m.f90~~EfferentGraph sourcefile~tensor_range_m.f90 tensor_range_m.f90 sourcefile~tensor_m.f90 tensor_m.f90 sourcefile~tensor_range_m.f90->sourcefile~tensor_m.f90 sourcefile~kind_parameters_m.f90 kind_parameters_m.f90 sourcefile~tensor_m.f90->sourcefile~kind_parameters_m.f90

Files dependent on this one

sourcefile~~tensor_range_m.f90~~AfferentGraph sourcefile~tensor_range_m.f90 tensor_range_m.f90 sourcefile~inference_engine_m.f90 inference_engine_m.f90 sourcefile~inference_engine_m.f90->sourcefile~tensor_range_m.f90 sourcefile~inference_engine_m_.f90 inference_engine_m_.f90 sourcefile~inference_engine_m.f90->sourcefile~inference_engine_m_.f90 sourcefile~trainable_engine_m.f90 trainable_engine_m.F90 sourcefile~inference_engine_m.f90->sourcefile~trainable_engine_m.f90 sourcefile~inference_engine_m_.f90->sourcefile~tensor_range_m.f90 sourcefile~layer_m.f90 layer_m.f90 sourcefile~layer_m.f90->sourcefile~tensor_range_m.f90 sourcefile~layer_m.f90->sourcefile~inference_engine_m_.f90 sourcefile~tensor_range_s.f90 tensor_range_s.f90 sourcefile~tensor_range_s.f90->sourcefile~tensor_range_m.f90 sourcefile~trainable_engine_m.f90->sourcefile~tensor_range_m.f90 sourcefile~trainable_engine_m.f90->sourcefile~inference_engine_m_.f90 sourcefile~concurrent-inferences.f90 concurrent-inferences.f90 sourcefile~concurrent-inferences.f90->sourcefile~inference_engine_m.f90 sourcefile~inference_engine_s.f90 inference_engine_s.F90 sourcefile~inference_engine_s.f90->sourcefile~inference_engine_m_.f90 sourcefile~inference_engine_s.f90->sourcefile~layer_m.f90 sourcefile~layer_s.f90 layer_s.f90 sourcefile~layer_s.f90->sourcefile~layer_m.f90 sourcefile~learn-addition.f90 learn-addition.F90 sourcefile~learn-addition.f90->sourcefile~inference_engine_m.f90 sourcefile~learn-exponentiation.f90 learn-exponentiation.F90 sourcefile~learn-exponentiation.f90->sourcefile~inference_engine_m.f90 sourcefile~learn-microphysics-procedures.f90 learn-microphysics-procedures.F90 sourcefile~learn-microphysics-procedures.f90->sourcefile~inference_engine_m.f90 sourcefile~thompson_tensors_m.f90 thompson_tensors_m.f90 sourcefile~learn-microphysics-procedures.f90->sourcefile~thompson_tensors_m.f90 sourcefile~learn-multiplication.f90 learn-multiplication.F90 sourcefile~learn-multiplication.f90->sourcefile~inference_engine_m.f90 sourcefile~learn-power-series.f90 learn-power-series.F90 sourcefile~learn-power-series.f90->sourcefile~inference_engine_m.f90 sourcefile~learn-saturated-mixing-ratio.f90 learn-saturated-mixing-ratio.F90 sourcefile~learn-saturated-mixing-ratio.f90->sourcefile~inference_engine_m.f90 sourcefile~saturated_mixing_ratio_m.f90 saturated_mixing_ratio_m.f90 sourcefile~learn-saturated-mixing-ratio.f90->sourcefile~saturated_mixing_ratio_m.f90 sourcefile~print-training-configuration.f90 print-training-configuration.F90 sourcefile~print-training-configuration.f90->sourcefile~inference_engine_m.f90 sourcefile~saturated_mixing_ratio_m.f90->sourcefile~inference_engine_m.f90 sourcefile~thompson_tensors_m.f90->sourcefile~inference_engine_m.f90 sourcefile~train-and-write.f90 train-and-write.F90 sourcefile~train-and-write.f90->sourcefile~inference_engine_m.f90 sourcefile~trainable_engine_s.f90 trainable_engine_s.F90 sourcefile~trainable_engine_s.f90->sourcefile~trainable_engine_m.f90 sourcefile~training_configuration_s.f90 training_configuration_s.F90 sourcefile~training_configuration_s.f90->sourcefile~inference_engine_m.f90 sourcefile~write-read-infer.f90 write-read-infer.F90 sourcefile~write-read-infer.f90->sourcefile~inference_engine_m.f90

Source Code

! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
module tensor_range_m
  use tensor_m, only : tensor_t
  use sourcery_m, only : string_t
  implicit none
  
  private
  public :: tensor_range_t

  type tensor_range_t
    private
    character(len=:), allocatable :: layer_
    real, allocatable, dimension(:) :: minima_, maxima_
  contains
    procedure map_to_training_range
    procedure map_from_training_range
    procedure to_json
    procedure in_range
    generic :: operator(==) => equals
    procedure, private :: equals
  end type

  interface tensor_range_t

    pure module function from_components(layer, minima, maxima) result(tensor_range)
      implicit none
      character(len=*), intent(in) :: layer
      real, dimension(:), intent(in) :: minima, maxima
      type(tensor_range_t) tensor_range
    end function

    module function from_json(lines) result(tensor_range)
      implicit none
      type(string_t), intent(in) :: lines(:)
      type(tensor_range_t) tensor_range
    end function

  end interface

  interface

    elemental module function map_to_training_range(self, tensor) result(normalized_tensor)
      implicit none
      class(tensor_range_t), intent(in) :: self
      type(tensor_t), intent(in) :: tensor
      type(tensor_t) normalized_tensor
    end function

    elemental module function map_from_training_range(self, tensor) result(unnormalized_tensor)
      implicit none
      class(tensor_range_t), intent(in) :: self
      type(tensor_t), intent(in) :: tensor
      type(tensor_t) unnormalized_tensor
    end function

    pure module function to_json(self) result(lines)
      implicit none
      class(tensor_range_t), intent(in) :: self
      type(string_t), allocatable :: lines(:)
    end function

    elemental module function equals(lhs, rhs) result(lhs_equals_rhs)
      implicit none
      class(tensor_range_t), intent(in) :: lhs, rhs
      logical lhs_equals_rhs
    end function

    elemental module function in_range(self, tensor) result(is_in_range)
      implicit none
      class(tensor_range_t), intent(in) :: self
      type(tensor_t), intent(in) :: tensor
      logical is_in_range
    end function

  end interface

end module tensor_range_m