UNPKG

ml-matrix

Version:

Matrix manipulation and computation library

21 lines (16 loc) 542 B
import { checkRowIndices } from '../util'; import BaseView from './base'; export default class MatrixRowSelectionView extends BaseView { constructor(matrix, rowIndices) { checkRowIndices(matrix, rowIndices); super(matrix, rowIndices.length, matrix.columns); this.rowIndices = rowIndices; } set(rowIndex, columnIndex, value) { this.matrix.set(this.rowIndices[rowIndex], columnIndex, value); return this; } get(rowIndex, columnIndex) { return this.matrix.get(this.rowIndices[rowIndex], columnIndex); } }