/** * Creates a new {@link CellMaskedMatrix} from a given {@link Matrix} and * maps, one for the row indices and one for the column indices. Only valid * mappings should be included. * * @param matrix The underlying matrix to decorate * @param rowMaskMap A mapping from new indices to old indices in the * original map for rows. * @param colMaskMap A mapping from new indices to old indices in the * original map for columns. */ public CellMaskedMatrix(Matrix matrix, int[] rowMaskMap, int[] colMaskMap) { this.matrix = matrix; this.rowMaskMap = rowMaskMap; this.colMaskMap = colMaskMap; assert arrayToSet(rowMaskMap).size() == rowMaskMap.length : "input mapping contains duplicates mappings to the same row"; assert arrayToSet(colMaskMap).size() == colMaskMap.length : "input mapping contains duplicates mappings to the same column"; }
/** * Creates a new {@link CellMaskedMatrix} from a given {@link Matrix} and * maps, one for the row indices and one for the column indices. Only valid * mappings should be included. * * @param matrix The underlying matrix to decorate * @param rowMaskMap A mapping from new indices to old indices in the * original map for rows. * @param colMaskMap A mapping from new indices to old indices in the * original map for columns. */ public CellMaskedMatrix(Matrix matrix, int[] rowMaskMap, int[] colMaskMap) { this.matrix = matrix; this.rowMaskMap = rowMaskMap; this.colMaskMap = colMaskMap; assert arrayToSet(rowMaskMap).size() == rowMaskMap.length : "input mapping contains duplicates mappings to the same row"; assert arrayToSet(colMaskMap).size() == colMaskMap.length : "input mapping contains duplicates mappings to the same column"; }