sum of all elements for each array stored in list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(array_list), | intent(in) | :: | list |
FUNCTION sum_of_arrays(list) !! sum of all elements for each array stored in list TYPE(array_list), INTENT(IN) :: list INTEGER, ALLOCATABLE, DIMENSION(:) :: sum_of_arrays INTEGER :: i_data, num_data num_data = number_of_arrays(list) ALLOCATE (sum_of_arrays(num_data)) DO i_data = 1, num_data sum_of_arrays(i_data) = SUM(list%col_data(list%ptr(i_data):list%ptr(i_data + 1) - 1)) END DO END FUNCTION sum_of_arrays