@@ -139,10 +139,10 @@ module stdlib_sorting
139139!! Version: experimental
140140!!
141141!! The generic subroutine implementing the `ORD_SORT` algorithm to return
142- !! an input array with its elements sorted in order of non-decreasing
142+ !! an input array with its elements sorted in order of ( non-) decreasing
143143!! value. Its use has the syntax:
144144!!
145- !! call ord_sort( array[, work] )
145+ !! call ord_sort( array[, work, reverse ] )
146146!!
147147!! with the arguments:
148148!!
@@ -161,6 +161,12 @@ module stdlib_sorting
161161!! storage, its use can significantly reduce the stack memory requirements
162162!! for the code. Its value on return is undefined.
163163!!
164+ !! * `reverse` (optional): shall be a scalar of type default logical. It
165+ !! is an `intent(in)` argument. If present with a value of `.true.` then
166+ !! `array` will be sorted in order of non-increasing values in stable
167+ !! order. Otherwise index will sort `array` in order of non-decreasing
168+ !! values in stable order.
169+ !!
164170!!#### Example
165171!!
166172!!```fortran
@@ -183,10 +189,10 @@ module stdlib_sorting
183189!! Version: experimental
184190!!
185191!! The generic subroutine implementing the `SORT` algorithm to return
186- !! an input array with its elements sorted in order of non-decreasing
192+ !! an input array with its elements sorted in order of ( non-) decreasing
187193!! value. Its use has the syntax:
188194!!
189- !! call sort( array )
195+ !! call sort( array[, reverse] )
190196!!
191197!! with the arguments:
192198!!
@@ -197,6 +203,11 @@ module stdlib_sorting
197203!! real and at least one of the elements is a `NaN`, then the ordering
198204!! of the result is undefined. Otherwise it is defined to be the
199205!! original elements in non-decreasing order.
206+ !! * `reverse` (optional): shall be a scalar of type default logical. It
207+ !! is an `intent(in)` argument. If present with a value of `.true.` then
208+ !! `array` will be sorted in order of non-increasing values in unstable
209+ !! order. Otherwise index will sort `array` in order of non-decreasing
210+ !! values in unstable order.
200211!!
201212!!#### Example
202213!!
@@ -351,7 +362,7 @@ module stdlib_sorting
351362 module subroutine char_ord_sort( array, work, reverse )
352363!! Version: experimental
353364!!
354- !! `char_ord_sort( array )` sorts the input `ARRAY` of type `CHARACTER(*)`
365+ !! `char_ord_sort( array[, work, reverse] )` sorts the input `ARRAY` of type `CHARACTER(*)`
355366!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
356367 character(len=*), intent(inout) :: array(0:)
357368 character(len=len(array)), intent(out), optional :: work(0:)
@@ -370,7 +381,7 @@ module stdlib_sorting
370381 pure module subroutine ${k1}$_sort( array, reverse )
371382!! Version: experimental
372383!!
373- !! `${k1}$_sort( array )` sorts the input `ARRAY` of type `${t1}$`
384+ !! `${k1}$_sort( array[, reverse] )` sorts the input `ARRAY` of type `${t1}$`
374385!! using a hybrid sort based on the `introsort` of David Musser.
375386!! The algorithm is of order O(N Ln(N)) for all inputs.
376387!! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
@@ -384,7 +395,7 @@ module stdlib_sorting
384395 pure module subroutine char_sort( array, reverse )
385396!! Version: experimental
386397!!
387- !! `char_sort( array )` sorts the input `ARRAY` of type `CHARACTER(*)`
398+ !! `char_sort( array[, reverse] )` sorts the input `ARRAY` of type `CHARACTER(*)`
388399!! using a hybrid sort based on the `introsort` of David Musser.
389400!! The algorithm is of order O(N Ln(N)) for all inputs.
390401!! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
@@ -411,7 +422,8 @@ module stdlib_sorting
411422 reverse )
412423!! Version: experimental
413424!!
414- !! `${k1}$_sort_index( array )` sorts an input `ARRAY` of type `${t1}$`
425+ !! `${k1}$_sort_index( array, index[, work, iwork, reverse] )` sorts
426+ !! an input `ARRAY` of type `${t1}$`
415427!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
416428!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
417429!! order that would sort the input `ARRAY` in the desired direction.
@@ -428,7 +440,8 @@ module stdlib_sorting
428440 reverse )
429441!! Version: experimental
430442!!
431- !! `char_sort_index( array )` sorts an input `ARRAY` of type `CHARACTER(*)`
443+ !! `char_sort_index( array, index[, work, iwork, reverse] )` sorts
444+ !! an input `ARRAY` of type `CHARACTER(*)`
432445!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
433446!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
434447!! order that would sort the input `ARRAY` in the desired direction.
0 commit comments