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