matrixInsert function
Matrix
matrixInsert(
- Matrix src,
- Matrix dest,
- int startRow,
- int startColumn,
)
Implementation
Matrix matrixInsert(Matrix src, Matrix dest, int startRow, int startColumn) {
assert(!startRow.isNegative && !startColumn.isNegative,
'Indexes cannot be less than 0');
assert(
dest.rowsNum - startRow >= src.rowsNum &&
dest.columnsNum - startColumn >= src.columnsNum,
'dest Matrix needs to fit into src Matrix at the given row and column');
List<List<double>> tmp = fromIterable(dest.toList());
for (int i = 0; i < src.rowsNum; i++) {
for (int j = 0; j < src.columnsNum; j++) {
tmp[startRow + i][startColumn + j] = src[i][j];
}
}
return Matrix.fromList(tmp);
}