Closed cg-laser closed 4 years ago
Hi fix looks okay to me. But I would have a few questions.
It is correct that in case of if (type(mask) == np.bool_):
which should be the normal case with two 1d-arrays we would just set the result to +1 regardless what happened. Is this function suppose to be used with something else than 1d arrays? If not we would always expect an np.bool_
and should require this.
because of rounding errors in the scalar products and norms, the value can be just slightly above 1. E.g. 1.00000000000001
. Therefore we need to catch it.
The if (type(mask) == np.bool_):
is required to distinguish between the first variable being a vector or a list of vectors. I fixed the else branch to
else:
if (mask1):
arccos = 1
if (mask2):
arccos = -1
I also added more documentation.
Ah, that makes sense. Looks good
Is this check even a good idea? By definition arccos should not be larger than 1, so if it is, something must have gone seriously wrong. Wouldn't we want to throw an error then?