DataFort Sorting Module
This module provides standalone functions for sorting and ranking operations on data frames. All functions take a data_frame as the first argument instead of being type-bound procedures.
df_sort_by_column(df, col_index, ascending) - Sort data frame by column valuesdf_is_sorted_real(df, col_index, ascending) - Check if real column is sorteddf_is_sorted_integer(df, col_index, ascending) - Check if integer column is sorteddf_rank_real(df, col_index, ascending) - Get ranks for real column valuesdf_rank_integer(df, col_index, ascending) - Get ranks for integer column valuesCheck if an integer column is sorted
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| logical, | intent(in), | optional | :: | ascending |
Check if a real column is sorted
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| logical, | intent(in), | optional | :: | ascending |
Rank values in an integer column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| logical, | intent(in), | optional | :: | ascending |
Rank values in a real column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| logical, | intent(in), | optional | :: | ascending |
Partition function for integer value quicksort
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| integer, | intent(in) | :: | low | |||
| integer, | intent(in) | :: | high | |||
| logical, | intent(in) | :: | ascending |
Partition function for real value quicksort
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| integer, | intent(in) | :: | low | |||
| integer, | intent(in) | :: | high | |||
| logical, | intent(in) | :: | ascending |
Sort data frame by column values
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in) | :: | col_index | |||
| logical, | intent(in), | optional | :: | ascending |
Quicksort implementation for integer value indices
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| integer, | intent(in) | :: | low | |||
| integer, | intent(in) | :: | high | |||
| logical, | intent(in) | :: | ascending |
Quicksort implementation for real value indices
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| integer, | intent(in) | :: | low | |||
| integer, | intent(in) | :: | high | |||
| logical, | intent(in) | :: | ascending |
Reorder all columns based on index array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(inout) | :: | df | |||
| integer, | intent(in), | dimension(:) | :: | indices |
Sort indices array based on integer values
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| logical, | intent(in) | :: | ascending |
Sort indices array based on real values
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in), | dimension(:) | :: | values | ||
| integer, | intent(inout), | dimension(:) | :: | indices | ||
| logical, | intent(in) | :: | ascending |