Vector.Zeros Like<T> Method
Constructs a new vector with the same length as the template, initialized to zero.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
C#
A new DenseVector<T> with the same length as template, initialized to zero.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
public static DenseVector<T> ZerosLike<T>(
Vector<T> template
)
Parameters
- template Vector<T>
- The vector whose length to copy.
Type Parameters
- T
- The element type of the vector.
Return Value
DenseVector<T>A new DenseVector<T> with the same length as template, initialized to zero.
Example
var original = Vector.Random(10);
var zeros = Vector.ZerosLike(original); // Vector of 10 zerosExceptions
| Argument | template is null. |