Tensor<T>.Map<TResult> Method

Applies a function to the elements of the tensor and returns the result in a second tensor.

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
C#
public Tensor<TResult> Map<TResult>(
	Func<T, TResult> function,
	Tensor<TResult>? result = null,
	Tensor<bool>? mask = null,
	TensorElementOrder order = TensorElementOrder.Automatic
)

Parameters

function  Func<T, TResult>
A delegate that represents a function of two variables
result  Tensor<TResult>  (Optional)
The tensor that is to hold the result. May be null.
mask  Tensor<Boolean>  (Optional)
Optional. A boolean that specifies for which elements the operation should be performed. If null (the default), the operation is applied everywhere.
order  TensorElementOrder  (Optional)
Optional. Specifies the element order of the result. By default, elements are stored in the order of the current tensor.

Type Parameters

TResult

Return Value

Tensor<TResult>
A tensor whose elements are the result of applying function to each element of the tensor.

Exceptions

ArgumentNullExceptionfunction is null.

See Also