From 8ebe8f6a539bc83bdb254ba99256527d961b05e6 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 3 Jun 2021 12:51:11 +0200 Subject: [PATCH 1/5] fix typo --- doc/specs/stdlib_sorting.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/specs/stdlib_sorting.md b/doc/specs/stdlib_sorting.md index 912b359fd..ae27f3a81 100644 --- a/doc/specs/stdlib_sorting.md +++ b/doc/specs/stdlib_sorting.md @@ -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 @@ -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 @@ -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 From 3cec2e5a3a64dfd5346fa31731b27e80e8c699e6 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 3 Jun 2021 13:20:38 +0200 Subject: [PATCH 2/5] update link --- src/stdlib_sorting.fypp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index b53008f2d..8cf684d7a 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -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. !! @@ -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 and three kinds of `REAL` arrays. By default, sorting -!! is in order of increasing value, though `SORT_INDEX` has the option of +!! of `INTEGER` arrays and three kinds of `REAL` arrays. +!! ([Specification](../page/specs/stdlib_sorting.html)) +!! +!!By default, sorting +!! is in order of increasing value, though all subroutines have the option of !! sorting in order of decresasing value. 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 performance of `O(N)`. @@ -140,7 +143,10 @@ module stdlib_sorting !! !! The generic subroutine implementing the `ORD_SORT` algorithm to return !! an input array with its elements sorted in order of (non-)decreasing -!! value. Its use has the syntax: +!! value. +!! ([Specification](../page/specs/stdlib_sorting.html#ord_sort-sorts-an-input-array)) +!! +!! Its use has the syntax: !! !! call ord_sort( array[, work, reverse] ) !! @@ -190,7 +196,10 @@ module stdlib_sorting !! !! The generic subroutine implementing the `SORT` algorithm to return !! an input array with its elements sorted in order of (non-)decreasing -!! value. Its use has the syntax: +!! value. +!! ([Specification](../page/specs/stdlib_sorting.html#sort-sorts-an-input-array)) +!! +!!Its use has the syntax: !! !! call sort( array[, reverse] ) !! @@ -229,6 +238,8 @@ module stdlib_sorting !! return an index array whose elements would sort the input array in the !! desired direction. It is primarily intended to be used to sort a !! derived type array based on the values of a component of the array. +!! ([Specification](../page/specs/stdlib_sorting.html#sort_index-creates-an-array-of-sorting-indices-for-an-input-array-while-also-sorting-the-array) +!! !! Its use has the syntax: !! !! call sort_index( array, index[, work, iwork, reverse ] ) From 50c96b87728d06710a7d7ddb6a90bf567c2ef2a9 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 3 Jun 2021 13:33:15 +0200 Subject: [PATCH 3/5] correct link --- src/stdlib_sorting.fypp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index 8cf684d7a..d8aecf211 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -143,10 +143,7 @@ module stdlib_sorting !! !! The generic subroutine implementing the `ORD_SORT` algorithm to return !! an input array with its elements sorted in order of (non-)decreasing -!! value. -!! ([Specification](../page/specs/stdlib_sorting.html#ord_sort-sorts-an-input-array)) -!! -!! Its use has the syntax: +!! value. Its use has the syntax: !! !! call ord_sort( array[, work, reverse] ) !! @@ -196,10 +193,7 @@ module stdlib_sorting !! !! The generic subroutine implementing the `SORT` algorithm to return !! an input array with its elements sorted in order of (non-)decreasing -!! value. -!! ([Specification](../page/specs/stdlib_sorting.html#sort-sorts-an-input-array)) -!! -!!Its use has the syntax: +!! value. Its use has the syntax: !! !! call sort( array[, reverse] ) !! @@ -238,8 +232,6 @@ module stdlib_sorting !! return an index array whose elements would sort the input array in the !! desired direction. It is primarily intended to be used to sort a !! derived type array based on the values of a component of the array. -!! ([Specification](../page/specs/stdlib_sorting.html#sort_index-creates-an-array-of-sorting-indices-for-an-input-array-while-also-sorting-the-array) -!! !! Its use has the syntax: !! !! call sort_index( array, index[, work, iwork, reverse ] ) @@ -351,7 +343,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 @@ -387,6 +382,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 ) @@ -424,7 +420,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. From f54a8fdc745f604c0530673438c4ae6d9368303e Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 3 Jun 2021 13:50:45 +0200 Subject: [PATCH 4/5] update --- src/stdlib_sorting.fypp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index d8aecf211..d7372d4dc 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -64,8 +64,9 @@ 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 and three kinds of `REAL` arrays. +!! `SORT_INDEX`, and `SORT`, that each can be used to sort arrays of assumed +!! length characters, of `sdtlib_string_type`, four kinds of `INTEGER` arrays +!! and three kinds of `REAL` arrays. !! ([Specification](../page/specs/stdlib_sorting.html)) !! !!By default, sorting @@ -421,7 +422,7 @@ module stdlib_sorting !! 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. -!! ([Specification](../page/specs/stdlib_sorting.html#sort_index-creates-an-array-of-sorting-indices-for-an-input-array-while-also-sorting-the-array) +!! ([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 From a83a46fcda363e64d083094f8d97d046d6c57663 Mon Sep 17 00:00:00 2001 From: Jeremie Vandenplas Date: Thu, 3 Jun 2021 13:57:56 +0200 Subject: [PATCH 5/5] update --- src/stdlib_sorting.fypp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index d7372d4dc..e7e482762 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -65,8 +65,8 @@ module stdlib_sorting !! This module implements overloaded sorting subroutines named `ORD_SORT`, !! `SORT_INDEX`, and `SORT`, that each can be used to sort arrays of assumed -!! length characters, of `sdtlib_string_type`, four kinds of `INTEGER` arrays -!! and three kinds of `REAL` arrays. +!! length characters, of `sdtlib_string_type` module `string_type`, +!! of four kinds of `INTEGER` and of three kinds of `REAL`. !! ([Specification](../page/specs/stdlib_sorting.html)) !! !!By default, sorting