just suggestion. if you use `valarray` for `v_normalised` and `w_normalised`, you can shorten the codes below, since you can write `diff = v_normalised-w_normalised; if (abs(diff).max()>eps) parallel = false;` and `v_normalised *= -1;`