numpoly.glexindex

numpoly.glexindex(start: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], stop: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, dimensions: int = 1, cross_truncation: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] = 1.0, graded: bool = False, reverse: bool = False)numpy.ndarray[source]

Generate graded lexicographical multi-indices for the monomial exponents.

Args:
start:

The lower order of the indices. If array of int, counts as lower bound for each axis.

stop:

The maximum shape included. If omitted: stop <- start; start <- 0 If int is provided, set as largest total order. If array of int, set as upper bound for each axis.

dimensions:

The number of dimensions in the expansion.

cross_truncation:

Use hyperbolic cross truncation scheme to reduce the number of terms in expansion. If two values are provided, first is low bound truncation, while the latter upper bound. If only one value, upper bound is assumed.

graded:

Graded sorting, meaning the indices are always sorted by the index sum. E.g. (2, 2, 2) has a sum of 6, and will therefore be consider larger than both (3, 1, 1) and (1, 1, 3).

reverse:

Reversed lexicographical sorting meaning that (1, 3) is considered smaller than (3, 1), instead of the opposite.

Return:
list:

Order list of indices.

Example:
>>> numpoly.glexindex(4).tolist()
[[0], [1], [2], [3]]
>>> numpoly.glexindex(2, dimensions=2).tolist()
[[0, 0], [1, 0], [0, 1]]
>>> numpoly.glexindex(start=2, stop=3, dimensions=2).tolist()
[[2, 0], [1, 1], [0, 2]]
>>> numpoly.glexindex([1, 2, 3]).tolist()
[[0, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 2]]
>>> numpoly.glexindex([1, 2, 3], cross_truncation=numpy.inf).tolist()
[[0, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 1], [0, 0, 2], [0, 1, 2]]