Vector.Map Method

Definition

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

Overload List

Map<T, U>(Func<T, U>, Vector<T>) Applies a function to the elements of a vector and returns the result in a new vector.
Map<T, U>(Func<Int32, T, U>, Vector<T>) Applies a function to the elements of a vector and returns the result in a new vector.
Map<T, 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<T, 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<T, 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

T
U

Return Value

Vector<U>
A new vector.

Exceptions

ArgumentNullException

function is null.

-or-

vector is null.

Map<T, U>(Func<Int32, 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<T, U>(
	Func<int, T, U> function,
	Vector<T> vector
)

Parameters

function  Func<Int32, T, U>
A delegate that maps the index and the value to a result.
vector  Vector<T>
A vector whose elements to apply function to.

Type Parameters

T
U

Return Value

Vector<U>
A new vector.

Exceptions

ArgumentNullException

function is null.

-or-

vector is null.

Map<T, 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<T, 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

T
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