cumsum Subroutine

public subroutine cumsum(x, cs)

Calculate cumulative sum

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(:):: x

Array to sum

real(kind=Float64), intent(out), dimension(:):: cs

Cumulative sum of x


Called by

proc~~cumsum~~CalledByGraph proc~cumsum cumsum proc~get_nlaunch get_nlaunch proc~get_nlaunch->proc~cumsum proc~get_nlaunch_pass_grid get_nlaunch_pass_grid proc~get_nlaunch_pass_grid->proc~cumsum proc~dcx dcx proc~dcx->proc~get_nlaunch proc~fida_f fida_f proc~fida_f->proc~get_nlaunch proc~pnpa_f pnpa_f proc~pnpa_f->proc~get_nlaunch_pass_grid proc~halo halo proc~halo->proc~get_nlaunch proc~fida_weights_mc fida_weights_mc proc~fida_weights_mc->proc~get_nlaunch proc~npa_f npa_f proc~npa_f->proc~get_nlaunch proc~pfida_f pfida_f proc~pfida_f->proc~get_nlaunch_pass_grid program~fidasim fidasim program~fidasim->proc~dcx program~fidasim->proc~fida_f program~fidasim->proc~pnpa_f program~fidasim->proc~halo program~fidasim->proc~fida_weights_mc program~fidasim->proc~npa_f program~fidasim->proc~pfida_f

Contents

Source Code


Source Code

subroutine cumsum(x, cs)
    !+ Calculate cumulative sum
    real(Float64), dimension(:), intent(in)  :: x
        !+ Array to sum
    real(Float64), dimension(:), intent(out) :: cs
        !+ Cumulative sum of `x`

    integer :: i, n
    real(Float64) :: cdf_val, t

    n = size(x)
    t = 0.d0
    do i=1, n
        cs(i) = t + x(i)
        t = cs(i)
    enddo

end subroutine cumsum