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


ssclib (ssclib-4.30) [xmmsas_20160201_1833-15.0.0]

Value at histogram fraction Array or vector scalar sumInt32 Home Index

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


sumInt32Dbl

The Fortran90 builtin function sum() returns the value in as the same type as its argument (at least in NAG Fortran specification). For example, when aryInt8 is an array of Integer(int8), the returned value of sum(aryInt8) is also Integer(int8) -- which is practically not very useful, as the total sum of aryInt8 is very likely to exceed the maximum (or minimum if negative) possible number of Integer(int8) (which can be obtained with huge() function).

This subroutine is developed to avoid that problem; it still returns the total sum of the array as sum() does, but always returns the type Integer(int32) and/or Real(double) if requested, whether the type of the argument is int8/16/32. In addition if an overflow happens during the calculation, that is, if the absolute value of the total sum is larger than huge(int32_variable), the returned Integer(int32) are INTEGER_NULL, which is defined in DAL. Also if the size of the given array is zero, the returned values are INTEGER_NULL and REAL_NULL.

sumInt32Dbl() can accept up to 4-dimensional arrays at the time of writing.

See also Section 2.6.6 for the handier, function version of this routine sumInt32().

interface sumInt32Dbl
  subroutine sumInt32DblInt81d(ary, sumInInt32, sumInDbl)
    integer(int8),  intent(in) :: ary(:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt81d
  subroutine sumInt32DblInt161d(ary, sumInInt32, sumInDbl)
    integer(int16), intent(in) :: ary(:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt161d
  subroutine sumInt32DblInt321d(ary, sumInInt32, sumInDbl)
    integer(int32), intent(in) :: ary(:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt321d

  subroutine sumInt32DblInt82d(ary, sumInInt32, sumInDbl)
    integer(int8),  intent(in) :: ary(:,:)
    integer(int32), intent(out), optional :: sumInInt32
  end subroutine sumInt32DblInt82d
  subroutine sumInt32DblInt162d(ary, sumInInt32, sumInDbl)
    integer(int16), intent(in) :: ary(:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt162d
  subroutine sumInt32DblInt322d(ary, sumInInt32, sumInDbl)
    integer(int32), intent(in) :: ary(:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt322d

  subroutine sumInt32DblInt83d(ary, sumInInt32, sumInDbl)
    integer(int8),  intent(in) :: ary(:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt83d
  subroutine sumInt32DblInt163d(ary, sumInInt32, sumInDbl)
    integer(int16), intent(in) :: ary(:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt163d
  subroutine sumInt32DblInt323d(ary, sumInInt32, sumInDbl)
    integer(int32), intent(in) :: ary(:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt323d

  subroutine sumInt32DblInt84d(ary, sumInInt32, sumInDbl)
    integer(int8),  intent(in) :: ary(:,:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt84d
  subroutine sumInt32DblInt164d(ary, sumInInt32, sumInDbl)
    integer(int16), intent(in) :: ary(:,:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt164d
  subroutine sumInt32DblInt324d(ary, sumInInt32, sumInDbl)
    integer(int32), intent(in) :: ary(:,:,:,:)
    integer(int32), intent(out), optional :: sumInInt32
    real(double),   intent(out), optional :: sumInDbl
  end subroutine sumInt32DblInt324d
end interface


Value at histogram fraction Array or vector scalar sumInt32 Home Index

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