Vector.CreateSparseUnitVector<T> Method

Constructs a new sparse vector of the specified length.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2
C#
public static SparseVector<T> CreateSparseUnitVector<T>(
	int length,
	int position,
	ArrayMutability mutability = ArrayMutability.Immutable
)

Parameters

length  Int32
The length of the SparseVector<T>.
position  Int32
The position of the non-zero element of the unit vector.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is mutable values.

Type Parameters

T

Return Value

SparseVector<T>
A SparseVector<T>.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

-or-

position is less than zero or greater than or equal to length.

See Also