Class ArraySlicingRoutines
- Namespace
- NeuralNetworks.Core
- Assembly
- NeuralNetworks.dll
Provides array slicing and row/column manipulation routines for supported multidimensional array types.
public static class ArraySlicingRoutines
- Inheritance
-
ArraySlicingRoutines
- Inherited Members
Remarks
Includes extension methods for selecting rows, columns, and ranges across dimensions, splitting row sets by ratio, and writing row values back into arrays. Most slicing operations return new arrays rather than views.
Methods
GetColumn(float[,], int)
Gets a submatrix containing the specified column from the current source. The shape is [rows, 1].
public static float[,] GetColumn(this float[,] source, int column)
Parameters
Returns
- float[,]
A new [rows, 1] array representing the selected column.
GetColumns(float[,], Range)
Gets a submatrix containing the specified range of columns from the current source. The shape is [rows, range].
public static float[,] GetColumns(this float[,] source, Range range)
Parameters
Returns
- float[,]
A new array with [rows, selectedColumns].
GetRow(float[,,,], int)
Gets a three-dimensional slice (row) from a four-dimensional array at the specified first-dimension index.
public static float[,,] GetRow(this float[,,,] source, int row)
Parameters
sourcefloat[,,,]The four-dimensional array to slice.
rowintThe zero-based index along dimension 0.
Returns
- float[,,]
A new three-dimensional array with shape [dim1, dim2, dim3] containing the selected row.
GetRow(float[,], int)
Gets a row from the source.
public static float[] GetRow(this float[,] source, int row)
Parameters
Returns
- float[]
A new array representing the specified row.
Remarks
The returned row is a new instance and has the same number of columns as the original source.
GetRowAs2D(float[,], int)
Gets the specified row as a two-dimensional array with shape [1, columns].
public static float[,] GetRowAs2D(this float[,] source, int row)
Parameters
Returns
- float[,]
A new [1, columns] array containing the row values.
GetRows(int[,], Range)
public static int[,] GetRows(this int[,] source, Range range)
Parameters
Returns
- int[,]
GetRows(float[,,,], Range)
Gets a contiguous range of rows from a four-dimensional array.
public static float[,,,] GetRows(this float[,,,] source, Range range)
Parameters
Returns
- float[,,,]
A new four-dimensional array containing the selected rows.
GetRows(float[,,], Range)
Gets a contiguous range of rows from a three-dimensional array.
public static float[,,] GetRows(this float[,,] source, Range range)
Parameters
Returns
- float[,,]
A new three-dimensional array containing the selected rows.
GetRows(float[,], Range)
Gets a submatrix containing the specified range of rows from the current source.
public static float[,] GetRows(this float[,] source, Range range)
Parameters
Returns
- float[,]
A new array representing the submatrix.
Remarks
The returned columns are the same as in the original source.
SetRow(float[,,,], int, float[,,])
Sets the three-dimensional row slice at the specified index in a four-dimensional array.
public static void SetRow(this float[,,,] source, int rowIndex, float[,,] row)
Parameters
sourcefloat[,,,]The four-dimensional array to modify.
rowIndexintThe zero-based index along dimension 0 to set.
rowfloat[,,]A three-dimensional array with shape [dim1, dim2, dim3] providing values.
SetRow(float[,], int, float[])
Sets the values of a specific row in the source.
public static void SetRow(this float[,] source, int rowIndex, float[] row)
Parameters
sourcefloat[,]The two-dimensional array to modify.
rowIndexintThe index of the row to set.
rowfloat[]The array containing the values to set. Length must equal the number of columns.
SliceDim0<T>(T, int, int)
public static T SliceDim0<T>(T source, int startInclusive, int endExclusive) where T : notnull
Parameters
Returns
- T
Type Parameters
T
SplitRowsByRatio(float[,], float)
Splits the source into two sets of dim1 based on the specified ratio.
public static (float[,] Set1, float[,] Set2) SplitRowsByRatio(this float[,] source, float ratio)