|
1 | 1 |
|
| 2 | + |
| 3 | + |
2 | 4 | !! Licensing:
|
3 | 5 | !!
|
4 | 6 | !! 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 )
|
431 | 433 | logical, intent(in), optional :: reverse
|
432 | 434 | end subroutine string_type_ord_sort
|
433 | 435 |
|
434 |
| - |
435 | 436 | module subroutine char_ord_sort( array, work, reverse )
|
436 | 437 | !! Version: experimental
|
437 | 438 | !!
|
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:) |
442 | 442 | character(len=len(array)), intent(out), optional :: work(0:)
|
443 |
| - logical, intent(in), optional :: reverse |
| 443 | + logical, intent(in), optional :: reverse |
444 | 444 | end subroutine char_ord_sort
|
445 | 445 |
|
| 446 | + |
446 | 447 | end interface ord_sort
|
447 | 448 |
|
448 | 449 | interface sort
|
@@ -548,19 +549,19 @@ pure module subroutine string_type_sort( array, reverse )
|
548 | 549 | logical, intent(in), optional :: reverse
|
549 | 550 | end subroutine string_type_sort
|
550 | 551 |
|
551 |
| - |
552 | 552 | pure module subroutine char_sort( array, reverse )
|
553 | 553 | !! Version: experimental
|
554 | 554 | !!
|
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. |
557 | 557 | !! The algorithm is of order O(N Ln(N)) for all inputs.
|
558 | 558 | !! Because it relies on `quicksort`, the coefficient of the O(N Ln(N))
|
559 | 559 | !! 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 |
562 | 562 | end subroutine char_sort
|
563 | 563 |
|
| 564 | + |
564 | 565 | end interface sort
|
565 | 566 |
|
566 | 567 | interface sort_index
|
@@ -705,23 +706,23 @@ module subroutine string_type_sort_index( array, index, work, iwork, &
|
705 | 706 | logical, intent(in), optional :: reverse
|
706 | 707 | end subroutine string_type_sort_index
|
707 | 708 |
|
708 |
| - |
709 | 709 | module subroutine char_sort_index( array, index, work, iwork, &
|
710 | 710 | reverse )
|
711 | 711 | !! Version: experimental
|
712 | 712 | !!
|
713 | 713 | !! `char_sort_index( array, index[, work, iwork, reverse] )` sorts
|
714 |
| -!! an input `ARRAY` of type `CHARACTER(*)` |
| 714 | +!! an input `ARRAY` of type `character(len=*)` |
715 | 715 | !! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
|
716 | 716 | !! and returns the sorted `ARRAY` and an array `INDEX of indices in the
|
717 | 717 | !! 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 |
723 | 723 | end subroutine char_sort_index
|
724 | 724 |
|
| 725 | + |
725 | 726 | end interface sort_index
|
726 | 727 |
|
727 | 728 |
|
|
0 commit comments