@@ -139,10 +139,10 @@ module stdlib_sorting
139
139
!! Version: experimental
140
140
!!
141
141
!! 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
143
143
!! value. Its use has the syntax:
144
144
!!
145
- !! call ord_sort( array[, work] )
145
+ !! call ord_sort( array[, work, reverse ] )
146
146
!!
147
147
!! with the arguments:
148
148
!!
@@ -161,6 +161,12 @@ module stdlib_sorting
161
161
!! storage, its use can significantly reduce the stack memory requirements
162
162
!! for the code. Its value on return is undefined.
163
163
!!
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
+ !!
164
170
!!#### Example
165
171
!!
166
172
!!```fortran
@@ -183,10 +189,10 @@ module stdlib_sorting
183
189
!! Version: experimental
184
190
!!
185
191
!! 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
187
193
!! value. Its use has the syntax:
188
194
!!
189
- !! call sort( array )
195
+ !! call sort( array[, reverse] )
190
196
!!
191
197
!! with the arguments:
192
198
!!
@@ -197,6 +203,11 @@ module stdlib_sorting
197
203
!! real and at least one of the elements is a `NaN`, then the ordering
198
204
!! of the result is undefined. Otherwise it is defined to be the
199
205
!! 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.
200
211
!!
201
212
!!#### Example
202
213
!!
@@ -351,7 +362,7 @@ module stdlib_sorting
351
362
module subroutine char_ord_sort( array, work, reverse )
352
363
!! Version: experimental
353
364
!!
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(*)`
355
366
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
356
367
character(len=*), intent(inout) :: array(0:)
357
368
character(len=len(array)), intent(out), optional :: work(0:)
@@ -370,7 +381,7 @@ module stdlib_sorting
370
381
pure module subroutine ${k1}$_sort( array, reverse )
371
382
!! Version: experimental
372
383
!!
373
- !! `${k1}$_sort( array )` sorts the input `ARRAY` of type `${t1}$`
384
+ !! `${k1}$_sort( array[, reverse] )` sorts the input `ARRAY` of type `${t1}$`
374
385
!! using a hybrid sort based on the `introsort` of David Musser.
375
386
!! The algorithm is of order O(N Ln(N)) for all inputs.
376
387
!! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
@@ -384,7 +395,7 @@ module stdlib_sorting
384
395
pure module subroutine char_sort( array, reverse )
385
396
!! Version: experimental
386
397
!!
387
- !! `char_sort( array )` sorts the input `ARRAY` of type `CHARACTER(*)`
398
+ !! `char_sort( array[, reverse] )` sorts the input `ARRAY` of type `CHARACTER(*)`
388
399
!! using a hybrid sort based on the `introsort` of David Musser.
389
400
!! The algorithm is of order O(N Ln(N)) for all inputs.
390
401
!! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
@@ -411,7 +422,8 @@ module stdlib_sorting
411
422
reverse )
412
423
!! Version: experimental
413
424
!!
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}$`
415
427
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
416
428
!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
417
429
!! order that would sort the input `ARRAY` in the desired direction.
@@ -428,7 +440,8 @@ module stdlib_sorting
428
440
reverse )
429
441
!! Version: experimental
430
442
!!
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(*)`
432
445
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
433
446
!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
434
447
!! order that would sort the input `ARRAY` in the desired direction.
0 commit comments