dot method
Implementation
double dot(Vector otherVector) {
var a = elements,
b = otherVector.elements,
aLen = a.length,
bLen = b.length,
i = 0,
j = 0;
num aVal = 0, dotProduct = 0, bVal = 0;
while (i < aLen && j < bLen) {
aVal = a[i];
bVal = b[j];
if (aVal < bVal) {
i += 2;
} else if (aVal > bVal) {
j += 2;
} else if (aVal == bVal) {
dotProduct += a[i + 1] * b[j + 1];
i += 2;
j += 2;
}
}
return dotProduct.toDouble();
}