ml-matrix
Version:
Matrix manipulation and computation library
21 lines (16 loc) • 569 B
JavaScript
import { checkColumnIndices } from '../util';
import BaseView from './base';
export default class MatrixColumnSelectionView extends BaseView {
constructor(matrix, columnIndices) {
checkColumnIndices(matrix, columnIndices);
super(matrix, matrix.rows, columnIndices.length);
this.columnIndices = columnIndices;
}
set(rowIndex, columnIndex, value) {
this.matrix.set(rowIndex, this.columnIndices[columnIndex], value);
return this;
}
get(rowIndex, columnIndex) {
return this.matrix.get(rowIndex, this.columnIndices[columnIndex]);
}
}