@@ -41,7 +41,9 @@ def on_boundary(self, x):
4141 return np .logical_and (self .inside (x ), _on_boundary )
4242
4343 def boundary_normal (self , x ):
44- _n = np .isclose (x , self .xmin ) * - 1.0 + np .isclose (x , self .xmax ) * 1.0
44+ _n = - np .isclose (x , self .xmin ).astype (config .real (np )) + np .isclose (
45+ x , self .xmax
46+ )
4547 # For vertices, the normal is averaged for all directions
4648 idx = np .count_nonzero (_n , axis = - 1 ) > 1
4749 if np .any (idx ):
@@ -97,7 +99,8 @@ def periodic_point(self, x, component):
9799
98100class Hypersphere (Geometry ):
99101 def __init__ (self , center , radius ):
100- self .center , self .radius = np .array (center ), radius
102+ self .center = np .array (center , dtype = config .real (np ))
103+ self .radius = radius
101104 super (Hypersphere , self ).__init__ (
102105 len (center ), (self .center - radius , self .center + radius ), 2 * radius
103106 )
@@ -144,7 +147,7 @@ def random_points(self, n, random="pseudo"):
144147 def random_boundary_points (self , n , random = "pseudo" ):
145148 """http://mathworld.wolfram.com/HyperspherePointPicking.html"""
146149 if random == "pseudo" :
147- X = np .random .normal (size = (n , self .dim ))
150+ X = np .random .normal (size = (n , self .dim )). astype ( config . real ( np ))
148151 else :
149152 U = sample (n , self .dim , random )
150153 X = stats .norm .ppf (U )
0 commit comments