Skip to content

Commit

Permalink
fix dtype of Normal.evalf for 1d argument
Browse files Browse the repository at this point in the history
The `evaluable.Normal` class has a fast implementation of `evalf` for
one-dimensional geometries. This implementation, however, returns an array with
the same dtype as the argument of `evalf`, the local gradient of the geometry,
which could be different from the dtype announced by `evaluable.Normal`:
`float`. This patch fixes the problem by adding an explicit cast to a `float`.
  • Loading branch information
joostvanzwieten committed Apr 14, 2021
1 parent 4cfa5c7 commit 672facd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nutils/evaluable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ def __init__(self, lgrad:asarray):
def evalf(self, lgrad):
n = lgrad[...,-1]
if equalindex(n.shape[-1], 1): # geom is 1D
return numpy.sign(n)
return numpy.sign(n).astype(float)
# orthonormalize n to G
G = lgrad[...,:-1]
GG = numeric.contract(G[...,:,_,:], G[...,:,:,_], axis=-3)
Expand Down

0 comments on commit 672facd

Please sign in to comment.