naginterfaces.library.sort.realvec_​rank_​rearrange

naginterfaces.library.sort.realvec_rank_rearrange(rv, m1, irank)[source]

realvec_rank_rearrange rearranges a vector of real numbers into the order specified by a vector of ranks.

For full information please refer to the NAG Library document for m01ea

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/m01/m01eaf.html

Parameters
rvfloat, array-like, shape

Elements to of must contain real values to be rearranged.

m1int

Note: this argument represents an array index; the value you supply must be base-1 for compatibility with the NAG Engine.

and must specify the range of the ranks supplied in and the elements of to be rearranged.

irankint, array-like, shape

Elements to of must contain a permutation of the integers to , which are interpreted as a vector of ranks.

Returns
rvfloat, ndarray, shape

These values are rearranged into rank order. For example, if , then the initial value of is moved to .

irankint, ndarray, shape

Used as internal workspace prior to being restored and hence is unchanged.

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

does not contain a permutation of the integers to . contains an out-of-range value: , .

(errno )

does not contain a permutation of the integers to . contains a repeated value: .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

realvec_rank_rearrange is designed to be used typically in conjunction with the ranking functions realvec_rank(), intvec_rank(), charvec_rank(), realmat_rank_rows(), intmat_rank_rows(), realmat_rank_columns(), intmat_rank_columns() and arbitrary_rank(). After one of those functions has been called to determine a vector of ranks, realvec_rank_rearrange can be called to rearrange a vector of real numbers into the rank order. If the vector of ranks has been generated in some other way, then permute_check() should be called to check its validity before realvec_rank_rearrange is called.