df_cumsum_real Subroutine

public subroutine df_cumsum_real(df, col_index)

Calculate cumulative sum for a real column (modifies in place)

Each element becomes the sum of all elements up to and including that position

@param[in,out] df The data frame instance @param[in] col_index Index of the column

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(inout) :: df
integer, intent(in) :: col_index

Source Code

    subroutine df_cumsum_real(df, col_index)
        type(data_frame), intent(inout) :: df
        integer, intent(in) :: col_index

        real(rk), dimension(:), allocatable :: col
        integer :: i

        col = df_get_col_real(df, col_index)
        do i = 2, size(col)
            col(i) = col(i) + col(i - 1)
        end do
        call df_set_col_real(df, col_index, col)
    end subroutine df_cumsum_real