Vector.From Function Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
Overload List
| From | Constructs a new dense vector with elements initialized by a function. |
| From | Constructs a new dense vector with elements initialized by a function. |
FromFunction<T>(Int32, Func<Int32, T>, ArrayMutability)
Constructs a new dense vector with elements initialized by a function.
public static DenseVector<T> FromFunction<T>(
int length,
Func<int, T> initializer,
ArrayMutability mutability = ArrayMutability.MutableValues
)
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.
Type Parameters
- T
Return Value
DenseVector<T>A DenseVector<T> whose elements are initialized using initializer.
Exceptions
| Argument | initializer is null. |
| Argument | length is less than zero. |
FromFunction<T>(Int32, Func<Int32, T>, ArrayMutability, Boolean)
Constructs a new dense vector with elements initialized by a function.
public static DenseVector<T> FromFunction<T>(
int length,
Func<int, T> initializer,
ArrayMutability mutability,
bool checkMissingValues
)
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
- Specifies how the vector's values may be changed. The default is mutable values.
- checkMissingValues Boolean
- Specifies whether operations involving the vector should check for the presence of missing values.
Type Parameters
- T
Return Value
DenseVector<T>A DenseVector<T> whose elements are initialized using initializer.
Exceptions
| Argument | initializer is null. |
| Argument | length is less than zero. |