argsort

  • full name: tenpy.tools.misc.argsort

  • parent module: tenpy.tools.misc

  • type: function

tenpy.tools.misc.argsort(a, sort=None, **kwargs)[source]

wrapper around np.argsort to allow sorting ascending/descending and by magnitude.

Parameters
aarray_like

the array to sort

sort'm>', 'm<', '>', '<', None

Specify how the arguments should be sorted.

sort

order

'm>', 'LM'

Largest magnitude first

'm<', 'SM'

Smallest magnitude first

'>', 'LR', 'LA'

Largest real part first

'<', 'SR', 'SA'

Smallest real part first

'LI'

Largest imaginary part first

'Si'

Smallest imaginary part first

None

numpy default: same as ‘<’

**kwargs :

further keyword arguments given directly to numpy.argsort().

Returns
index_arrayndarray, int

same shape as a, such that a[index_array] is sorted in the specified way.