tensor_m.f90 Source File


This file depends on

sourcefile~~tensor_m.f90~~EfferentGraph sourcefile~tensor_m.f90 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_m.f90~~AfferentGraph sourcefile~tensor_m.f90 tensor_m.f90 sourcefile~fiats_m.f90 fiats_m.f90 sourcefile~fiats_m.f90->sourcefile~tensor_m.f90 sourcefile~input_output_pair_m.f90 input_output_pair_m.f90 sourcefile~fiats_m.f90->sourcefile~input_output_pair_m.f90 sourcefile~neural_network_m.f90 neural_network_m.f90 sourcefile~fiats_m.f90->sourcefile~neural_network_m.f90 sourcefile~tensor_map_m.f90 tensor_map_m.f90 sourcefile~fiats_m.f90->sourcefile~tensor_map_m.f90 sourcefile~mini_batch_m.f90 mini_batch_m.f90 sourcefile~fiats_m.f90->sourcefile~mini_batch_m.f90 sourcefile~trainable_network_m.f90 trainable_network_m.f90 sourcefile~fiats_m.f90->sourcefile~trainable_network_m.f90 sourcefile~input_output_pair_m.f90->sourcefile~tensor_m.f90 sourcefile~neural_network_m.f90->sourcefile~tensor_m.f90 sourcefile~neural_network_m.f90->sourcefile~tensor_map_m.f90 sourcefile~neural_network_m.f90->sourcefile~mini_batch_m.f90 sourcefile~tensor_map_m.f90->sourcefile~tensor_m.f90 sourcefile~tensor_s.f90 tensor_s.f90 sourcefile~tensor_s.f90->sourcefile~tensor_m.f90 sourcefile~concurrent-inferences.f90 concurrent-inferences.f90 sourcefile~concurrent-inferences.f90->sourcefile~fiats_m.f90 sourcefile~input_output_pair_s.f90 input_output_pair_s.f90 sourcefile~input_output_pair_s.f90->sourcefile~input_output_pair_m.f90 sourcefile~layer_m.f90 layer_m.f90 sourcefile~layer_m.f90->sourcefile~neural_network_m.f90 sourcefile~layer_m.f90->sourcefile~tensor_map_m.f90 sourcefile~learn-addition.f90 learn-addition.F90 sourcefile~learn-addition.f90->sourcefile~fiats_m.f90 sourcefile~learn-exponentiation.f90 learn-exponentiation.F90 sourcefile~learn-exponentiation.f90->sourcefile~fiats_m.f90 sourcefile~learn-multiplication.f90 learn-multiplication.F90 sourcefile~learn-multiplication.f90->sourcefile~fiats_m.f90 sourcefile~learn-power-series.f90 learn-power-series.F90 sourcefile~learn-power-series.f90->sourcefile~fiats_m.f90 sourcefile~learn-saturated-mixing-ratio.f90 learn-saturated-mixing-ratio.F90 sourcefile~learn-saturated-mixing-ratio.f90->sourcefile~fiats_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~mini_batch_m.f90->sourcefile~input_output_pair_m.f90 sourcefile~neural_network_s.f90 neural_network_s.F90 sourcefile~neural_network_s.f90->sourcefile~neural_network_m.f90 sourcefile~neural_network_s.f90->sourcefile~layer_m.f90 sourcefile~print-training-configuration.f90 print-training-configuration.F90 sourcefile~print-training-configuration.f90->sourcefile~fiats_m.f90 sourcefile~read-query-infer.f90 read-query-infer.f90 sourcefile~read-query-infer.f90->sourcefile~fiats_m.f90 sourcefile~saturated_mixing_ratio_m.f90->sourcefile~fiats_m.f90 sourcefile~tensor_map_s.f90 tensor_map_s.F90 sourcefile~tensor_map_s.f90->sourcefile~tensor_map_m.f90 sourcefile~train-and-write.f90 train-and-write.F90 sourcefile~train-and-write.f90->sourcefile~fiats_m.f90 sourcefile~trainable_network_m.f90->sourcefile~input_output_pair_m.f90 sourcefile~trainable_network_m.f90->sourcefile~neural_network_m.f90 sourcefile~trainable_network_m.f90->sourcefile~tensor_map_m.f90 sourcefile~trainable_network_m.f90->sourcefile~mini_batch_m.f90 sourcefile~unmapped_network_s.f90 unmapped_network_s.F90 sourcefile~unmapped_network_s.f90->sourcefile~neural_network_m.f90 sourcefile~workspace_s.f90 workspace_s.F90 sourcefile~workspace_s.f90->sourcefile~neural_network_m.f90 sourcefile~write-read-infer.f90 write-read-infer.F90 sourcefile~write-read-infer.f90->sourcefile~fiats_m.f90 sourcefile~layer_s.f90 layer_s.F90 sourcefile~layer_s.f90->sourcefile~layer_m.f90 sourcefile~mini_batch_s.f90 mini_batch_s.f90 sourcefile~mini_batch_s.f90->sourcefile~mini_batch_m.f90 sourcefile~trainable_network_s.f90 trainable_network_s.F90 sourcefile~trainable_network_s.f90->sourcefile~trainable_network_m.f90

Source Code

! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
module tensor_m
  use kind_parameters_m, only : default_real, double_precision
  implicit none

  private
  public :: tensor_t

  type tensor_t(k)
    integer, kind :: k = default_real 
    real(k), allocatable, private :: values_(:)
  contains
    generic   :: values => default_real_values, double_precision_values
    procedure, private, non_overridable ::  default_real_values, double_precision_values
    generic :: num_components => default_real_num_components, double_precision_num_components
    procedure, private ::        default_real_num_components, double_precision_num_components
  end type

  interface tensor_t

    pure module function construct_default_real(values) result(tensor)
      implicit none
      real, intent(in) :: values(:)
      type(tensor_t) tensor
    end function

    pure module function construct_double_precision(values) result(tensor)
      implicit none
      double precision, intent(in) :: values(:)
      type(tensor_t(double_precision)) tensor
    end function

  end interface

  interface

    pure module function default_real_values(self) result(tensor_values)
      implicit none
      class(tensor_t), intent(in) :: self
      real, allocatable :: tensor_values(:)
    end function

    pure module function double_precision_values(self) result(tensor_values)
      implicit none
      class(tensor_t(double_precision)), intent(in) :: self
      double precision, allocatable :: tensor_values(:)
    end function

    pure module function default_real_num_components(self) result(n)
      implicit none
      class(tensor_t), intent(in) :: self
      integer n
    end function

    pure module function double_precision_num_components(self) result(n)
      implicit none
      class(tensor_t(double_precision)), intent(in) :: self
      integer n
    end function

  end interface

end module tensor_m