Skip to content

Mainly added some links #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/specs/stdlib_sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ increasing, or decreasing, value.

##### Syntax

`call [[stdlib_sorting(module):ord_sort(subroutine)]]ord_sort ( array[, work, reverse ] )`
`call [[stdlib_sorting(module):ord_sort(interface)]]( array[, work, reverse ] )`

##### Class

Expand Down Expand Up @@ -286,7 +286,7 @@ decreasing, value.

##### Syntax

`call [[stdlib_sorting(module):sort(subroutine)]]sort ( array[, reverse] )`
`call [[stdlib_sorting(module):sort(interface)]]( array[, reverse] )`

##### Class

Expand Down Expand Up @@ -349,7 +349,7 @@ sort the input `array` to produce the output `array`.

##### Syntax

`call [[stdlib_sorting(module):sort_index(subroutine)]]sort_index ( array, index[, work, iwork, reverse ] )`
`call [[stdlib_sorting(module):sort_index(interface)]]( array, index[, work, iwork, reverse ] )`

##### Class

Expand Down
20 changes: 15 additions & 5 deletions src/stdlib_sorting.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

!! Licensing:
!!
!! This file is subjec† both to the Fortran Standard Library license, and
!! This file is subject both to the Fortran Standard Library license, and
!! to additional licensing requirements as it contains translations of
!! other software.
!!
Expand Down Expand Up @@ -65,8 +65,11 @@
module stdlib_sorting
!! This module implements overloaded sorting subroutines named `ORD_SORT`,
!! `SORT_INDEX`, and `SORT`, that each can be used to sort four kinds
!! of `INTEGER` arrays, three kinds of `REAL` arrays, character(len=*) arrays,
!! and arrays of type(string_type). By default sorting is in order of
!! of `INTEGER` arrays, three kinds of `REAL` arrays, `character(len=*)` arrays,
!! and arrays of `type(string_type)`.
!! ([Specification](../page/specs/stdlib_sorting.html))
!!
!! By default sorting is in order of
!! increasing value, but there is an option to sort in decreasing order.
!! All the subroutines have worst case run time performance of `O(N Ln(N))`,
!! but on largely sorted data `ORD_SORT` and `SORT_INDEX` can have a run time
Expand Down Expand Up @@ -341,7 +344,10 @@ module stdlib_sorting
!! `slice.rs`
!! https://github.com/rust-lang/rust/blob/90eb44a5897c39e3dff9c7e48e3973671dcd9496/src/liballoc/slice.rs#L2159
!! `ORD_SORT` is a hybrid stable comparison algorithm combining `merge sort`,
!! and `insertion sort`. It is always at worst O(N Ln(N)) in sorting random
!! and `insertion sort`.
!! ([Specification](../page/specs/stdlib_sorting.html#ord_sort-sorts-an-input-array))
!!
!! It is always at worst O(N Ln(N)) in sorting random
!! data, having a performance about 25% slower than `SORT` on such
!! data, but has much better performance than `SORT` on partially
!! sorted data, having O(N) performance on uniformly non-increasing or
Expand Down Expand Up @@ -377,6 +383,7 @@ module stdlib_sorting
!!
!! The generic subroutine interface implementing the `SORT` algorithm, based
!! on the `introsort` of David Musser.
!! ([Specification](../page/specs/stdlib_sorting.html#sort-sorts-an-input-array))

#:for k1, t1 in IRS_KINDS_TYPES
pure module subroutine ${k1}$_sort( array, reverse )
Expand Down Expand Up @@ -414,7 +421,10 @@ module stdlib_sorting
!! based on the `"Rust" sort` algorithm found in `slice.rs`
!! https://github.com/rust-lang/rust/blob/90eb44a5897c39e3dff9c7e48e3973671dcd9496/src/liballoc/slice.rs#L2159
!! but modified to return an array of indices that would provide a stable
!! sort of the rank one `ARRAY` input. The indices by default correspond to a
!! sort of the rank one `ARRAY` input.
!! ([Specification](../page/specs/stdlib_sorting.html#sort_index-creates-an-array-of-sorting-indices-for-an-input-array-while-also-sorting-the-array))
!!
!! The indices by default correspond to a
!! non-decreasing sort, but if the optional argument `REVERSE` is present
!! with a value of `.TRUE.` the indices correspond to a non-increasing sort.

Expand Down