XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


ssclib (ssclib-4.30) [xmmsas_20160201_1833-15.0.0]

Simpler maxloc Array or vector scalar Get ubound Home Index

Meta Index / Home Page / General-purpose array-processing utilities / Array or vector scalar

Simpler minloc

The fortran routine minloc(array) returns the indices at which the minimum value in array occurs. However the return must be a vector quantity of the same size as the array has dimensions. This can be slightly clunky if array is of dimension 1 - ie, a 1-dimensional vector. The function minLoc1d allows one to obtain the index of the minimum value of the 1-D argument in a scalar return value. This can save some lines of code.

  interface minLoc1d
    function minLoc1dSingle(vector, mask)
      real(single),  intent(in)           :: vector(:)
      logical(bool), intent(in), optional :: mask(:)
      integer                             :: minLoc1dSingle
    end function

    function minLoc1dDouble(vector, mask)
      real(double),  intent(in)           :: vector(:)
      logical(bool), intent(in), optional :: mask(:)
      integer                             :: minLoc1dSingle
    end function
  end interface



XMM-Newton SOC/SSC -- 2016-02-01