Tensor.Map Into Method
Definition
Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
Overload List
Map | Applies a function to the elements of a tensor. |
Map | Applies a function to the corresponding elements of two tensors. |
Map | Applies a function to the corresponding elements of three tensors. |
MapInto<T, TResult>(Func<T, TResult>, Tensor<T>, Tensor<TResult>, Tensor<Boolean>, TensorElementOrder)
Applies a function to the elements of a tensor.
public static Tensor<TResult> MapInto<T, TResult>(
Func<T, TResult> function,
Tensor<T> operand,
Tensor<TResult>? result,
Tensor<bool>? mask = null,
TensorElementOrder order = TensorElementOrder.Automatic
)
Parameters
- function Func<T, TResult>
- A delegate that represents a function of one variable.
- operand Tensor<T>
- A tensor whose elements serve as the argument to the function.
- 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. If result is null, the desired ordering in memory of the result.
Type Parameters
- T
- The type of the operand of the function.
- TResult
- The type of the result.
Return Value
Tensor<TResult>A tensor whose elements are the result of applying function to the elements of operand.
Remarks
The shapes of all tensor operands, including mask (if present), must be compatible. When result is given, all other tensors must be broadcastable into it. Otherwise, the shape of the result is the smallest shape that all other tensor arguments can be broadcast into.
Exceptions
Argument | function is null.
-or- operand is null |
MapInto<T1, T2, TResult>(Func<T1, T2, TResult>, Tensor<T1>, Tensor<T2>, Tensor<TResult>, Tensor<Boolean>, TensorElementOrder)
Applies a function to the corresponding elements of two tensors.
public static Tensor<TResult> MapInto<T1, T2, TResult>(
Func<T1, T2, TResult> function,
Tensor<T1> first,
Tensor<T2> second,
Tensor<TResult>? result,
Tensor<bool>? mask = null,
TensorElementOrder order = TensorElementOrder.Automatic
)
Parameters
- function Func<T1, T2, TResult>
- A delegate that represents a function of two variables
- first Tensor<T1>
- A tensor whose elements serve as the first argument to the function.
- second Tensor<T2>
- A tensor whose elements serve as the second argument to the function.
- result Tensor<TResult>
- 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. If result is null, the desired ordering in memory of the result.
Type Parameters
- T1
- T2
- TResult
Return Value
Tensor<TResult>A tensor whose elements are the result of applying function to the corresponding elements of first and second.
Exceptions
Argument | function is null.
-or- first is null -or- second is null |
Dimension | The length of first does not equal the length of second. |
MapInto<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult>, Tensor<T1>, Tensor<T2>, Tensor<T3>, Tensor<TResult>, Tensor<Boolean>, TensorElementOrder)
Applies a function to the corresponding elements of three tensors.
public static Tensor<TResult> MapInto<T1, T2, T3, TResult>(
Func<T1, T2, T3, TResult> function,
Tensor<T1> first,
Tensor<T2> second,
Tensor<T3> third,
Tensor<TResult> result,
Tensor<bool>? mask = null,
TensorElementOrder order = TensorElementOrder.Automatic
)
Parameters
- function Func<T1, T2, T3, TResult>
- A delegate that represents a function of two variables
- first Tensor<T1>
- A tensor whose elements serve as the first argument to the function.
- second Tensor<T2>
- A tensor whose elements serve as the second argument to the function.
- third Tensor<T3>
- A tensor whose elements serve as the second argument to the function.
- result Tensor<TResult>
- 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. If result is null, the desired ordering in memory of the result.
Type Parameters
- T1
- The type of the first operand of the function.
- T2
- The type of the second operand of the function.
- T3
- The type of the third operand of the function.
- TResult
- The type of the result.
Return Value
Tensor<TResult>A tensor whose elements are the result of applying function to the corresponding elements of first and second.
Exceptions
Argument | function is null.
-or- first is null -or- second is null -or- third is null |
Dimension | The length of first does not equal the length of second. -or- The length of first does not equal the length of third. |