stdlib_selection#

See also the specification page: stdlib_selection.

stdlib_selection (module)#

Quickly find the k-th smallest value of an array, or the index of the k-th smallest value. (Specification: stdlib_selection)

Interfaces

select (interface)#

select (interface)

(Specification: stdlib_selection)

Procedures:

arg_select (interface)#

arg_select (interface)

(Specification: stdlib_selection)

Procedures:

Procedures

select_1_iint8_int8 (subroutine)#

subroutine select_1_iint8_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint8_int16 (subroutine)#

subroutine select_1_iint8_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint8_int32 (subroutine)#

subroutine select_1_iint8_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint8_int64 (subroutine)#

subroutine select_1_iint8_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint16_int8 (subroutine)#

subroutine select_1_iint16_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint16_int16 (subroutine)#

subroutine select_1_iint16_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint16_int32 (subroutine)#

subroutine select_1_iint16_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint16_int64 (subroutine)#

subroutine select_1_iint16_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint32_int8 (subroutine)#

subroutine select_1_iint32_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint32_int16 (subroutine)#

subroutine select_1_iint32_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint32_int32 (subroutine)#

subroutine select_1_iint32_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint32_int64 (subroutine)#

subroutine select_1_iint32_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint64_int8 (subroutine)#

subroutine select_1_iint64_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint64_int16 (subroutine)#

subroutine select_1_iint64_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint64_int32 (subroutine)#

subroutine select_1_iint64_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_iint64_int64 (subroutine)#

subroutine select_1_iint64_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rsp_int8 (subroutine)#

subroutine select_1_rsp_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=sp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rsp_int16 (subroutine)#

subroutine select_1_rsp_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=sp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rsp_int32 (subroutine)#

subroutine select_1_rsp_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=sp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rsp_int64 (subroutine)#

subroutine select_1_rsp_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=sp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rdp_int8 (subroutine)#

subroutine select_1_rdp_int8(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int8), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=dp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rdp_int16 (subroutine)#

subroutine select_1_rdp_int16(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int16), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=dp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rdp_int32 (subroutine)#

subroutine select_1_rdp_int32(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int32), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=dp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

select_1_rdp_int64 (subroutine)#

subroutine select_1_rdp_int64(a, k, kth_smallest, left, right)

select - select the k-th smallest entry in a(:).

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(inout), dimension(:)

Array in which we seek the k-th smallest entry. On output it will be partially sorted such that all(a(1:(k-1)) <= a(k)) .and. all(a(k) <= a((k+1):size(a))) is true.

kinteger(kind=int64), intent(in)

We want the k-th smallest entry. E.G. k=1 leads to kth_smallest=min(a), and k=size(a) leads to kth_smallest=max(a)

kth_smallestreal(kind=dp), intent(out)

On output contains the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(left:right),

  • maxval(a(1:(left-1))) <= minval(a(left:right)), and

  • maxval(a(left:right)) <= minval(a((right+1):size(a))),

then one or both bounds can be specified to narrow the search. The constraints are available if we have previously called the subroutine with different k (because of how a(:) becomes partially sorted, see documentation for a(:)).

arg_select_1_iint8_int8 (subroutine)#

subroutine arg_select_1_iint8_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint8_int16 (subroutine)#

subroutine arg_select_1_iint8_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint8_int32 (subroutine)#

subroutine arg_select_1_iint8_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint8_int64 (subroutine)#

subroutine arg_select_1_iint8_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int8), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint16_int8 (subroutine)#

subroutine arg_select_1_iint16_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint16_int16 (subroutine)#

subroutine arg_select_1_iint16_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint16_int32 (subroutine)#

subroutine arg_select_1_iint16_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint16_int64 (subroutine)#

subroutine arg_select_1_iint16_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int16), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint32_int8 (subroutine)#

subroutine arg_select_1_iint32_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint32_int16 (subroutine)#

subroutine arg_select_1_iint32_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint32_int32 (subroutine)#

subroutine arg_select_1_iint32_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint32_int64 (subroutine)#

subroutine arg_select_1_iint32_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int32), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint64_int8 (subroutine)#

subroutine arg_select_1_iint64_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint64_int16 (subroutine)#

subroutine arg_select_1_iint64_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint64_int32 (subroutine)#

subroutine arg_select_1_iint64_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_iint64_int64 (subroutine)#

subroutine arg_select_1_iint64_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
ainteger(kind=int64), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rsp_int8 (subroutine)#

subroutine arg_select_1_rsp_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rsp_int16 (subroutine)#

subroutine arg_select_1_rsp_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rsp_int32 (subroutine)#

subroutine arg_select_1_rsp_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rsp_int64 (subroutine)#

subroutine arg_select_1_rsp_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=sp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rdp_int8 (subroutine)#

subroutine arg_select_1_rdp_int8(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int8), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int8), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int8), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int8), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rdp_int16 (subroutine)#

subroutine arg_select_1_rdp_int16(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int16), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int16), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int16), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int16), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rdp_int32 (subroutine)#

subroutine arg_select_1_rdp_int32(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int32), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int32), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int32), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int32), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

arg_select_1_rdp_int64 (subroutine)#

subroutine arg_select_1_rdp_int64(a, indx, k, kth_smallest, left, right)

arg_select - find the index of the k-th smallest entry in a(:)

Partly derived from the “Coretran” implementation of quickSelect by Leon Foks, leonfoks/coretran

Arguments:
areal(kind=dp), intent(in), dimension(:)

Array in which we seek the k-th smallest entry.

indxinteger(kind=int64), intent(inout), dimension(:)

Array of indices into a(:). Must contain each integer from 1:size(a) exactly once. On output it will be partially sorted such that:

all( a(indx(1:(k-1)))) <= a(indx(k)) ) .AND.
all( a(indx(k))  <= a(indx( (k+1):size(a) )) )
kinteger(kind=int64), intent(in)

We want index of the k-th smallest entry. E.G. k=1 leads to a(kth_smallest) = min(a), and k=size(a) leads to a(kth_smallest) = max(a)

kth_smallestinteger(kind=int64), intent(out)

On output contains the index with the k-th smallest value of a(:)

leftinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).

rightinteger(kind=int64), intent(in), optional

If we know that:

  • the k-th smallest entry of a is in a(indx(left:right)),

  • maxval(a(indx(1:(left-1)))) <= minval(a(indx(left:right))), and

  • maxval(a(indx(left:right))) <= minval(a(indx((right+1):size(a)))),

then one or both bounds can be specified to reduce the search time. These constraints are available if we have previously called the subroutine with a different k (due to the way that indx(:) becomes partially sorted, see documentation for indx(:)).