Vector.CopyFromRowsAsLists Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.2.0

Overload List

CopyFromRowsAsLists<T>(Matrix<T>) Constructs a new list vector by copying rows from a matrix.
CopyFromRowsAsLists<T>(Matrix<T>, T) Constructs a new list vector by copying rows from a matrix, trimming trailing padding values.

CopyFromRowsAsLists<T>(Matrix<T>)

Constructs a new list vector by copying rows from a matrix.
C#
public static ListVector<T> CopyFromRowsAsLists<T>(
	Matrix<T> matrix
)

Parameters

matrix  Matrix<T>
A matrix whose rows will become lists.

Type Parameters

T
The element type of the matrix.

Return Value

ListVector<T>
A ListVector<T> where each list corresponds to a matrix row.

Remarks

This method copies all elements from the matrix rows into lists. All lists will have the same length (number of columns in the matrix).

Exceptions

ArgumentNullException

matrix is null.

CopyFromRowsAsLists<T>(Matrix<T>, T)

Constructs a new list vector by copying rows from a matrix, trimming trailing padding values.
C#
public static ListVector<T> CopyFromRowsAsLists<T>(
	Matrix<T> matrix,
	T paddingValue
)

Parameters

matrix  Matrix<T>
A matrix whose rows will become lists.
paddingValue  T
The value to treat as padding and trim from the end of each row.

Type Parameters

T
The element type of the matrix.

Return Value

ListVector<T>
A ListVector<T> where each list corresponds to a matrix row with padding removed.

Remarks

This method copies rows from the matrix but removes trailing elements that equal paddingValue. This is useful for converting padded matrices back to variable-length lists.

Exceptions

ArgumentNullException

matrix is null.

See Also