From 672facdff101830b09ce896ee5c1c5f28e08a323 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Wed, 7 Apr 2021 12:50:06 +0200 Subject: [PATCH] fix dtype of Normal.evalf for 1d argument 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`. --- nutils/evaluable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nutils/evaluable.py b/nutils/evaluable.py index 47a7d21be..283a53521 100644 --- a/nutils/evaluable.py +++ b/nutils/evaluable.py @@ -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)