naginterfaces.library.sort.intmat_​rank_​columns

naginterfaces.library.sort.intmat_rank_columns(im, m1, n1, order)[source]

intmat_rank_columns ranks the columns of a matrix of integer numbers in ascending or descending order.

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

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/m01/m01dkf.html

Parameters
imint, array-like, shape

Rows to of columns to of must contain integer data to be ranked.

m1int

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

The index of the first row of to be used.

n1int

The index of the first column of to be ranked.

orderstr, length 1

If , the columns will be ranked in ascending (i.e., nondecreasing) order.

If , into descending order.

Returns
irankint, ndarray, shape

Elements to of contain the ranks of the corresponding columns of . Note that the ranks are in the range to : thus, if the th column of is the first in the rank order, is set to .

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, has an illegal value: .

Notes

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

intmat_rank_columns ranks columns to of a matrix, using the data in rows to of those columns. The ordering is determined by first ranking the data in row , then ranking any tied columns according to the data in row , and so on up to row .

intmat_rank_columns uses a variant of list-merging, as described on pages 165–166 in Knuth (1973). The function takes advantage of natural ordering in the data, and uses a simple list insertion in a preparatory pass to generate ordered lists of length at least . The ranking is stable: equal columns preserve their ordering in the input data.

References

Knuth, D E, 1973, The Art of Computer Programming (Volume 3), (2nd Edition), Addison–Wesley