Vector<T>.Map Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0

Overload List

Map<U>(Func<T, U>) Applies a function to the elements of a vector and returns the result.
Map<U>(Func<T, U>, Vector<T>) Applies a function to the elements of a vector and returns the result in a new vector.
Map<U, V>(Func<T, U, V>, Vector<T>, Vector<U>) Applies a function to the corresponding elements of two vectors and returns the result in a new vector.

Map<U>(Func<T, U>)

Applies a function to the elements of a vector and returns the result.
C#
public Vector<U> Map<U>(
	Func<T, U> function
)

Parameters

function  Func<T, U>
A delegate that represents a function of one variable

Type Parameters

U

Return Value

Vector<U>
The result of applying function to each element of this vector.

Exceptions

ArgumentNullException

function is null.

Map<U>(Func<T, U>, Vector<T>)

Applies a function to the elements of a vector and returns the result in a new vector.
C#
public static Vector<U> Map<U>(
	Func<T, U> function,
	Vector<T> vector
)

Parameters

function  Func<T, U>
A delegate that represents a function of one variable
vector  Vector<T>
A vector whose elements to apply function to.

Type Parameters

U

Return Value

Vector<U>
A new vector.

Exceptions

ArgumentNullException

function is null.

-or-

vector is null.

Map<U, V>(Func<T, U, V>, Vector<T>, Vector<U>)

Applies a function to the corresponding elements of two vectors and returns the result in a new vector.
C#
public static Vector<V> Map<U, V>(
	Func<T, U, V> function,
	Vector<T> first,
	Vector<U> second
)

Parameters

function  Func<T, U, V>
A delegate that represents a function of two variables
first  Vector<T>
A vector whose elements serve as the first argument to the function.
second  Vector<U>
A vector whose elements serve as the second argument to the function.

Type Parameters

U
V

Return Value

Vector<V>
A vector that is the result of applying function to the corresponding elements of first and this vector.

Exceptions

ArgumentNullException

function is null.

-or-

first is null.

-or-

second is null.

DimensionMismatchException

The length of first does not equal the length of second.

See Also