double (Vector vector) { int size = vector.getSize(); if (size != getSize()) throw new IllegalArgumentException("sizes mismatch"); double result = 0; for (int i = 0; i < size; i++) result += get(i) * vector.get(i); return result; }