operator + method
Implementation
ValueVector operator +(dynamic other) {
if (other is Value) {
return ValueVector(values.map((v) => v + other).toList());
}
if (other is ValueVector) {
// ValueVector operator +(ValueVector other) {
if (values.length != other.values.length) {
throw ArgumentError('Vector dimensions must match for addition');
}
return ValueVector(
List.generate(values.length, (i) => values[i] + other.values[i]));
}
throw UnimplementedError(
"Operation + not supported for: ${other.runtimeType}");
}