Matrix<T>.GetColumns Method

Definition

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

Overload List

GetColumns(IEnumerable<Int32>) Returns a new matrix that contains only the columns in the specified sequence.
GetColumns(Int32, Int32) Returns a matrix that contains only the specified columns of the current matrix.
GetColumns<C>(IEnumerable<C>) Returns a new matrix that contains only the columns in the specified sequence.

GetColumns(IEnumerable<Int32>)

Returns a new matrix that contains only the columns in the specified sequence.
C#
public Matrix<T> GetColumns(
	IEnumerable<int> indexes
)

Parameters

indexes  IEnumerable<Int32>
A sequence of indexes of the columns to return.

Return Value

Matrix<T>
A new matrix containing only the columns at the positions in indexes.

Exceptions

ArgumentNullException

indexes is null.

ArgumentException

At least one of the values in indexes is not a valid column index.

GetColumns<C>(IEnumerable<C>)

Returns a new matrix that contains only the columns in the specified sequence.
C#
public Matrix<T> GetColumns<C>(
	IEnumerable<C> keys
)

Parameters

keys  IEnumerable<C>
A sequence of keys of the columns to return.

Type Parameters

C

Return Value

Matrix<T>
A new matrix containing only the columns whose key is in keys.

Exceptions

ArgumentNullException

keys is null.

InvalidOperationException

The matrix does not have a column index.

InvalidCastException

The element type of the column index is not C.

GetColumns(Int32, Int32)

Returns a matrix that contains only the specified columns of the current matrix.
C#
public Matrix<T> GetColumns(
	int startColumn,
	int endColumn
)

Parameters

startColumn  Int32
The zero-based index of the first column to return.
endColumn  Int32
The zero-based index of the last column to return.

Return Value

Matrix<T>
A matrix containing column startColumn to endColumn of this matrix.

Exceptions

ArgumentOutOfRangeException

startColumn or endColumn is less than zero or greater than the number of columns of the matrix.

See Also