operator + method

Vector operator +(
  1. Vector other
)

Implementation

Vector operator +(Vector other) {
  assert(this.size == other.size, "Vector dimensions mismatch");

  final List<double> newEls = List<double>.from(this.elements);
  for (int i = 0; i < newEls.length; i++) {
    newEls[i] += other.elements[i];
  }

  return Vector.fromList(newEls);
}