array_api_negative_index package¶
- array_api_negative_index.arange_asymmetric(stop: int, /, *, xp: ArrayNamespaceFull, dtype: Any = None, device: Any = None) Array[source]¶
Create a symmetric array with values from -stop+1 to stop-1.
- Parameters:
stop (int) – The stop value (exclusive).
dtype (Any, optional) – The desired data type of the output array, by default None
device (Any, optional) – The device on which to create the array, by default None
xp (ArrayNamespaceFull, optional) – The array namespace to use, by default None
- Returns:
An array [0, 1, …, stop-1, -stop+1, …, -1]. The shape is (2 * stop - 1,).
- Return type:
Array
- array_api_negative_index.flip_symmetric(input: Array, /, *, axis: int = 0) Array[source]¶
Flip a symmetric array.
- Parameters:
input (Array) – The input array.
axis (int, optional) – The axis to flip, by default 0
include_zero_twice (bool, optional) – If True, the zeroth element is included twice, by default False
- Returns:
The flipped array. Forall a < input.shape[axis] result[-a-1] = result[a] = input[a] = input[-a-1]
- Return type:
Array
- array_api_negative_index.to_symmetric(input: Array, /, *, axis: int = 0, asymmetric: bool = False, conjugate: bool = False) Array[source]¶
Extend a tensor to its opposite symmetric form.
- Parameters:
input (Array) – The input tensor.
axis (int, optional) – The axis to extend, by default 0
asymmetric (bool, optional) – If True, the input tensor is multiplied by -1, by default False
conjugate (bool, optional) – If True, the input tensor is conjugated, by default False
- Returns:
The symmetric tensor. If not include_zero_twice, forall a < input.shape[axis] result[-a] = result[a] Else, forall a < input.shape[axis] result[-a-1] = result[a]
- Return type:
Array