Tensor.Sort Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3

Overload List

Sort<T>(Tensor<T>, IComparer<T>, Index, Tensor<T>, Tensor<Boolean>, TensorElementOrder)

Sorts the elements of a tensor.
C#
public static Tensor<T> Sort<T>(
	Tensor<T> tensor,
	IComparer<T> comparer,
	Index axis,
	Tensor<T>? result = null,
	Tensor<bool>? mask = null,
	TensorElementOrder order = TensorElementOrder.Automatic
)

Parameters

tensor  Tensor<T>
A tensor.
comparer  IComparer<T>
The IComparer<T> implementation to use when comparing elements, or null to use Comparer.
axis  Index
The axis along which the transformation is computed.
result  Tensor<T>  (Optional)
Optional. The tensor that is to hold the result. May be null.
mask  Tensor<Boolean>  (Optional)
Optional. A boolean tensor that specifies for which elements the operation should be performed. If null (the default), the operation is applied everywhere.
order  TensorElementOrder  (Optional)
Optional. If result is null, the desired ordering in memory of the result.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A tensor of the same shape as tensor whose elements are equal to the sorted of the corresponding elements of tensor.

Exceptions

ArgumentNullException

tensor is null.

Sort<T>(Tensor<T>, Index, Tensor<T>, Tensor<Boolean>, Boolean, TensorElementOrder)

Sorts the elements of a tensor.
C#
public static Tensor<T> Sort<T>(
	Tensor<T> value,
	Index axis,
	Tensor<T>? result = null,
	Tensor<bool>? mask = null,
	bool skipMissingValues = false,
	TensorElementOrder order = TensorElementOrder.Automatic
)

Parameters

value  Tensor<T>
A tensor.
axis  Index
The axis along which the transformation is computed.
result  Tensor<T>  (Optional)
Optional. The tensor that is to hold the result. May be null.
mask  Tensor<Boolean>  (Optional)
Optional. A boolean tensor that specifies for which elements should be included in the operation. If null (the default), the operation is applied everywhere.
skipMissingValues  Boolean  (Optional)
Optional. Specifies whether missing values should be excluded from the aggregation. The default is false.
order  TensorElementOrder  (Optional)
Optional. If result is null, the desired ordering in memory of the result.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A tensor of the same shape as whose elements are equal to the sorted of the corresponding elements of

Exceptions

ArgumentNullException

value is null.

See Also