Array2D class

This class provides utility functions for 2D arrays (matrices):

  • Extracting rows, columns, appending rows
  • Extracting sub-matrices, building envelopes
  • Computing projections or sums over rows or columns
  • Swapping or reversing rows
  • Finding minimum or maximum values

Constructors

Array2D()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

integrateRegion(List<Float64List> matrix, int startRow, int endRow, int startCol, int endCol) → Float64List
Integrates a submatrix of matrix. The submatrix boundaries are given by startRow, endRow, startCol, endCol. The indices are inclusive. Returns a list with 3 elements: 0 = sum of All matrix values in the region 1 = sum of the POSITIVE matrix values in the region 2 = sum of the NEGATIVE matrix values in the region
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Methods

appendRows(List<Float64List> rows, List<Float64List> matrix) → void
Appends each row of rows to matrix.
getColumn(List<Float64List> matrix, int col) → Float64List
Returns the column col >= 0 of matrix. Returns null if col is outside range. The result is a new Float64List! Modifying the col will therefore NOT modify the matrix!
getColumnMax(List<Float64List> matrix, int col, int firstRow, int lastRow) → double
Returns the maximum value in the column col of matrix. If firstRow and lastRow are not null, the maximum search inside col is performed from firstRow, inclusive, to lastRow, also inclusive.
getMinMax(List<Float64List> matrix) MinMax
Returns the mimimum and maximum value in a matrix and the respective indices.
getProjection(List<Float64List> matrix, int firstIx, int lastIx, MatrixProjSlice type) → Float64List
Returns a projection of rows (= "row projection") or of columns (= "column projection") of matrix. type = MatrixProjSlice.PROJ_ROW computes a "row" projection, MatrixProjSlice.PROJ_COL computes a "column" projection. If you think rows drawn horizontally (=x axis) and columns drawn perpendicular to the rows (= y axis), then a ROW projection "projects" the rows on to the x axis. A COLUMN projection "project" the columns onto the yaxis. project onto the row axis = F2. A ROW projection is defined as an array containing the maximum values of the columns between firstIx and lastIx (both indices inclusive). A COLUMN projection is defined as an array containing the maximum values of the rows between firstIx and lastIx (both indices inclusive). firstIx and lastIx are allowed to be null (at the same time). Then teh whole matrix is projected onto the axis defined by type.
getRow(List<Float64List> matrix, int row) → Float64List
Returns the row row >= 0 from matrix. Returns null if row of range. The result is the original row in the matrix, not a new list! Modifying the row will therefore modify the matrix!
getRowMax(List<Float64List> matrix, int row, int firstCol, int lastCol) → double
Returns the maximum value in the row row of matrix. If firstCol and lastCol are not null, the maximum search inside row is performed from firstCol, inclusive, to lastCol, also inclusive.
getSubmatrix(List<Float64List> matrix, int row1, int row2, int col1, int col2, bool negLevels) → List<Float64List>
Returns the submatrix of matrix defined by row1, row2, col1, col2. row2 and col2 are exclusive indices! row1/2 and col1/2 need not be ordered. 0<=row1,2<=sizef1, 0<=col1,2<=size- An exception is thrown in case of errors, e.g. indices out of range. The result may have 0 elements, depending on input indices. The result has (col2 - col1).abs() columns and (row2 - row1).abs() rows. negLevels = true means only negative values are retained, false means only positive values are retained, the respective others are set to 0 (= positive and negative envelopes, e.g. usefull for contour or 3D surface display of a matrix). Null means all values are retained without change. Returns the list of rows of the submatrix.
getSubmatrixAs1D(List<Float64List> matrix, int row1, int row2, int col1, int col2) → Float64List
Returns the submatrix of matrix defined by row1, row2, col1, col2 as a 1D array, a sequence of rows. The total array length is nrows * ncols, where nrows = row2 - row1 + 1 and ncols = col2 - col1 + 1. The indices are inclusive. The result may have 0 elements, depending on input indices. It is not relevant wheter rows1 is < or > row2, or col1 < or > col2. See also Array1D.splitArray to make a 2D array from the result. See also getSubmatrix.
getSumRowsCols(List<Float64List> matrix, bool sumRows, int type) → Float64List
Computes the sum of all rows, or the sum of all columms. sumRows - set true to sum rows, false to sum columns. type = POS: adds the positive or zero values of a1 and a2 only type = one of Array1D.POS, Array1D.NEG, Array1D.POSNEG to take into account only positive, negative, or all values to build the sum.
join(List<Float64List> matrix) → Float64List
Returns a one-dimensional array from a two-dimensional matrix by appending their rows in sequence. See also getSubmatrixAs1D.
reverseRows(List<List<double>> matrix) → void
Reverses the order of all rows of matrix. The result has the last row as the first one, the 2nd last one as the 2nd, etc.
swapRows(List<List<double>> matrix, int i, int j) → void
Swaps (interchanges) rows i and j of matrix