Skip to content

Commit da0c99a

Browse files
committed
Deploying to stdlib-fpm from @ 21e20f0 🚀
1 parent daab291 commit da0c99a

File tree

4 files changed

+434
-415
lines changed

4 files changed

+434
-415
lines changed

src/stdlib_sorting.f90

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
3+
24
!! Licensing:
35
!!
46
!! This file is subject both to the Fortran Standard Library license, and
@@ -431,18 +433,17 @@ module subroutine string_type_ord_sort( array, work, reverse )
431433
logical, intent(in), optional :: reverse
432434
end subroutine string_type_ord_sort
433435

434-
435436
module subroutine char_ord_sort( array, work, reverse )
436437
!! Version: experimental
437438
!!
438-
!! `char_ord_sort( array[, work, reverse] )` sorts the input `ARRAY` of type
439-
!! `CHARACTER(*)` using a hybrid sort based on the `'Rust" sort` algorithm
440-
!! found in `slice.rs`
441-
character(len=*), intent(inout) :: array(0:)
439+
!! `char_ord_sort( array )` sorts the input `ARRAY` of type `character(len=*)`
440+
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
441+
character(len=*), intent(inout) :: array(0:)
442442
character(len=len(array)), intent(out), optional :: work(0:)
443-
logical, intent(in), optional :: reverse
443+
logical, intent(in), optional :: reverse
444444
end subroutine char_ord_sort
445445

446+
446447
end interface ord_sort
447448

448449
interface sort
@@ -548,19 +549,19 @@ pure module subroutine string_type_sort( array, reverse )
548549
logical, intent(in), optional :: reverse
549550
end subroutine string_type_sort
550551

551-
552552
pure module subroutine char_sort( array, reverse )
553553
!! Version: experimental
554554
!!
555-
!! `char_sort( array[, reverse] )` sorts the input `ARRAY` of type
556-
!! `CHARACTER(*)` using a hybrid sort based on the `introsort` of David Musser.
555+
!! `char_sort( array[, reverse] )` sorts the input `ARRAY` of type `character(len=*)`
556+
!! using a hybrid sort based on the `introsort` of David Musser.
557557
!! The algorithm is of order O(N Ln(N)) for all inputs.
558558
!! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
559559
!! behavior is small for random data compared to other sorting algorithms.
560-
character(len=*), intent(inout) :: array(0:)
561-
logical, intent(in), optional :: reverse
560+
character(len=*), intent(inout) :: array(0:)
561+
logical, intent(in), optional :: reverse
562562
end subroutine char_sort
563563

564+
564565
end interface sort
565566

566567
interface sort_index
@@ -705,23 +706,23 @@ module subroutine string_type_sort_index( array, index, work, iwork, &
705706
logical, intent(in), optional :: reverse
706707
end subroutine string_type_sort_index
707708

708-
709709
module subroutine char_sort_index( array, index, work, iwork, &
710710
reverse )
711711
!! Version: experimental
712712
!!
713713
!! `char_sort_index( array, index[, work, iwork, reverse] )` sorts
714-
!! an input `ARRAY` of type `CHARACTER(*)`
714+
!! an input `ARRAY` of type `character(len=*)`
715715
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
716716
!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
717717
!! order that would sort the input `ARRAY` in the desired direction.
718-
character(len=*), intent(inout) :: array(0:)
719-
integer(int_size), intent(out) :: index(0:)
720-
character(len=len(array)), intent(out), optional :: work(0:)
721-
integer(int_size), intent(out), optional :: iwork(0:)
722-
logical, intent(in), optional :: reverse
718+
character(len=*), intent(inout) :: array(0:)
719+
integer(int_size), intent(out) :: index(0:)
720+
character(len=len(array)), intent(out), optional :: work(0:)
721+
integer(int_size), intent(out), optional :: iwork(0:)
722+
logical, intent(in), optional :: reverse
723723
end subroutine char_sort_index
724724

725+
725726
end interface sort_index
726727

727728

0 commit comments

Comments
 (0)