/** * The columnsCount is compatible with the size of the vector space Constructor. * * @param rowsCount * @param columnsCount * @param value */ DenseMatrix(int rowsCount, int columnsCount, F value) { super( DenseVectorSpaceProvider.getInstance() .getVectorSpaceOver(value.getAlgebricStructure(), columnsCount)); this.rowsCount = rowsCount; this.columnsCount = columnsCount; all = new Object[rowsCount * columnsCount]; for (int i = 0; i < this.rowsCount * columnsCount; i++) { all[i] = value; } }
public DenseMatrix(Matrix<F> other) { super( DenseVectorSpaceProvider.getInstance() .getVectorSpaceOver(other.getField(), other.columnsCount())); this.rowsCount = other.rowsCount(); this.columnsCount = other.columnsCount(); all = new Object[rowsCount * columnsCount]; for (int r = 0; r < this.rowsCount; r++) { for (int c = 0; c < this.columnsCount; c++) { this.set(r, c, other.get(r, c)); } } }