getProjection method

Float64List getProjection (List<Float64List> matrix, int firstIx, int lastIx, MatrixProjSlice type)

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.

Implementation

static Float64List getProjection(
    List<Float64List> matrix, int firstIx, int lastIx, MatrixProjSlice type) {
  Float64List result;
  if (type == MatrixProjSlice.PROJ_ROW) {
    int ncols = matrix[0].length; // = rowlength!
    result = new Float64List(ncols);
    for (int j = 0; j < ncols; j++) {
      result[j] = getColumnMax(matrix, j, firstIx, lastIx);
    }
  } else if (type == MatrixProjSlice.PROJ_COL) {
    int nrows = matrix.length; // = collength!
    result = new Float64List(nrows);
    for (int j = 0; j < nrows; j++) {
      result[j] = getRowMax(matrix, j, firstIx, lastIx);
    }
  }
  return result;
}