Skip to content

Commit c8981f9

Browse files
committed
update specs
1 parent b1e51da commit c8981f9

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/specs/stdlib_sorting.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ data:
4646
* `ORD_SORT` is intended to sort simple arrays of intrinsic data
4747
that have significant sections that were partially ordered before
4848
the sort;
49-
* `SORT_ADJ` is based on `ORD_SORT`, but in addition to sorting the
49+
* `SORT_ADJOINT` is based on `ORD_SORT`, but in addition to sorting the
5050
input array, it returns a related array re-ordered in the
5151
same way;
5252
* `SORT_INDEX` is based on `ORD_SORT`, but in addition to sorting the
@@ -63,10 +63,10 @@ data:
6363
The Fortran Standard Library is distributed under the MIT
6464
License. However components of the library may be based on code with
6565
additional licensing restrictions. In particular `ORD_SORT`,
66-
`SORT_ADJ`, `SORT_INDEX`, and `SORT` are translations of codes with their
66+
`SORT_ADJOINT`, `SORT_INDEX`, and `SORT` are translations of codes with their
6767
own distribution restrictions.
6868

69-
The `ORD_SORT`, `SORT_ADJ` and `SORT_INDEX` subroutines are essentially
69+
The `ORD_SORT`, `SORT_ADJOINT` and `SORT_INDEX` subroutines are essentially
7070
translations to Fortran 2008 of the `"Rust" sort` of the Rust Language
7171
distributed as part of
7272
[`slice.rs`](https://github.com/rust-lang/rust/blob/90eb44a5897c39e3dff9c7e48e3973671dcd9496/src/liballoc/slice.rs).
@@ -143,20 +143,20 @@ argument or allocated internally on the stack.
143143
Arrays can be also sorted in a decreasing order by providing the argument `reverse
144144
= .true.`.
145145

146-
#### The `SORT_ADJ` subroutine
146+
#### The `SORT_ADJOINT` subroutine
147147

148148
The `SORT` and `ORD_SORT` subroutines can sort rank 1 isolated
149149
arrays of intrinsic types, but do nothing for the coordinated sorting
150150
of related data, e.g., a related rank 1 array. Therefore the module
151-
provides a subroutine, `SORT_ADJ`, that re-order such a rank 1 array
151+
provides a subroutine, `SORT_ADJOINT`, that re-order such a rank 1 array
152152
in the same way as the input array based on the `ORD_SORT` algorithm,
153153
in addition to sorting the input array.
154154

155-
The logic of `SORT_ADJ` parallels that of `ORD_SORT`, with
155+
The logic of `SORT_ADJOINT` parallels that of `ORD_SORT`, with
156156
additional housekeeping to keep the associated array consistent with
157157
the sorted positions of the input array. Because of this additional
158158
housekeeping it has slower runtime performance than `ORD_SORT`.
159-
`SORT_ADJ` requires the use of two "scratch" arrays, that may be
159+
`SORT_ADJOINT` requires the use of two "scratch" arrays, that may be
160160
provided as optional `work` and `iwork` arguments or allocated
161161
internally on the stack.
162162

@@ -218,7 +218,7 @@ factor of six. Still, even when it shows enhanced performance, its
218218
performance on partially sorted data is typically an order of
219219
magnitude slower than `ORD_SORT`. Its memory requirements are also
220220
low, being of order O(Ln(N)), while the memory requirements of
221-
`ORD_SORT`, `SORT_ADJ` and `SORT_INDEX` are of order O(N).
221+
`ORD_SORT`, `SORT_ADJOINT` and `SORT_INDEX` are of order O(N).
222222

223223
#### The `RADIX_SORT` subroutine
224224

@@ -405,7 +405,7 @@ element of `array` is a `NaN`.
405405
{!example/sorting/example_radix_sort.f90!}
406406
```
407407

408-
#### `sort_adj` - sorts an associated array in the same way as the input array, while also sorting the array.
408+
#### `sort_adjoint` - sorts an associated array in the same way as the input array, while also sorting the array.
409409

410410
##### Status
411411

@@ -419,7 +419,7 @@ sorted in the same way as the input `array`.
419419

420420
##### Syntax
421421

422-
`call ` [[stdlib_sorting(module):sort_adj(interface)]] `( array, index[, work, iwork, reverse ] )`
422+
`call ` [[stdlib_sorting(module):sort_adjoint(interface)]] `( array, adjoint_array[, work, iwork, reverse ] )`
423423

424424
##### Class
425425

@@ -435,7 +435,7 @@ It is an `intent(inout)` argument. On input it
435435
will be an array whose sorting indices are to be determined. On return
436436
it will be the sorted array.
437437

438-
`index`: shall be a rank one `integer` or `real` array of
438+
`adjoint_array`: shall be a rank one `integer` or `real` array of
439439
the size of `array`. It is an `intent(inout)` argument. On return it
440440
shall have values that are the indices needed to sort the original
441441
array in the desired direction.
@@ -448,7 +448,7 @@ static storage, its use can significantly reduce the stack memory
448448
requirements for the code. Its contents on return are undefined.
449449

450450
`iwork` (optional): shall be a rank one integer array of the same kind
451-
of the array `index`, and shall have at least `size(array)/2` elements. It
451+
of the array `adjoint_array`, and shall have at least `size(array)/2` elements. It
452452
is an `intent(out)` argument. It is intended to be used as "scratch"
453453
memory for internal record keeping. If associated with an array in
454454
static storage, its use can significantly reduce the stack memory
@@ -462,13 +462,13 @@ values in stable order.
462462

463463
##### Notes
464464

465-
`SORT_ADJ` implements the hybrid sorting algorithm of `ORD_SORT`,
466-
keeping the values of `index` consistent with the elements of `array`
465+
`SORT_ADJOINT` implements the hybrid sorting algorithm of `ORD_SORT`,
466+
keeping the values of `adjoint_array` consistent with the elements of `array`
467467
as it is sorted. As a `merge sort` based algorithm, it is a stable
468468
sorting comparison algorithm. The optional `work` and `iwork` arrays
469469
replace "scratch" memory that would otherwise be allocated on the
470470
stack. If `array` is of any kind of `REAL` the order of the elements in
471-
`index` and `array` on return are undefined if any element of `array`
471+
`adjoint_array` and `array` on return are undefined if any element of `array`
472472
is a `NaN`. Sorting of `CHARACTER(*)` and `STRING_TYPE` arrays are
473473
based on the operator `>`, and not on the function `LGT`.
474474

@@ -477,10 +477,10 @@ different on return
477477

478478
##### Examples
479479

480-
Sorting a rank one array with `sort_adj`:
480+
Sorting a rank one array with `sort_adjoint`:
481481

482482
```Fortran
483-
{!example/sorting/example_sort_adj.f90!}
483+
{!example/sorting/example_sort_adjoint.f90!}
484484
```
485485

486486
#### `sort_index` - creates an array of sorting indices for an input array, while also sorting the array.

0 commit comments

Comments
 (0)