Vector.CreateFromFunction<T> Method

Constructs a new dense vector.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0
C#
public static DenseVector<T> CreateFromFunction<T>(
	int length,
	Func<int, T> initializer,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

length  Int32
The length of the vector.
initializer  Func<Int32, T>
A delegate that returns the value of a element given its index.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T> whose elements are initialized using initializer.

Exceptions

ArgumentNullException

initializer is null.

ArgumentOutOfRangeException

length is less than zero.

See Also