subtractVector method
Subtract a vector from a matrix
Implementation
Matrix subtractVector(Vector vector) {
if (rowCount != vector.length) {
throw ArgumentError(
"Matrix and vector dimensions must match for subtraction.");
}
Matrix result = copy();
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
result[i][j] -= vector[i];
}
}
return result;
}