numpoly.cross_truncate

numpoly.cross_truncate(indices: 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]]], bound: 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]]], norm: float)numpy.ndarray[source]

Truncate of indices using L_p norm.

where \(b_i\) are bounds that each \(x_i\) should follow.

Args:
indices:

Indices to be truncated.

bound:

The bound function for witch the indices can not be larger than.

norm:

The p in the L_p-norm. Support includes both L_0 and L_inf.

Return:

Boolean indices to indices with True for each index where the truncation criteria holds.

Example:
>>> indices = numpy.array(numpy.mgrid[:10, :10]).reshape(2, -1).T
>>> indices[cross_truncate(indices, 2, norm=0.)].T
array([[0, 0, 0, 1, 2],
       [0, 1, 2, 0, 0]])
>>> indices[cross_truncate(indices, 2, norm=1.)].T
array([[0, 0, 0, 1, 1, 2],
       [0, 1, 2, 0, 1, 0]])
>>> indices[cross_truncate(indices, [0, 1], norm=1.)].T
array([[0, 0],
       [0, 1]])