Skip to content

Commit b766803

Browse files
philippeitisJoseph Weston
authored andcommitted
Update triangulation.py
Use numpy's abs only for vectors.
1 parent be5a908 commit b766803

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

adaptive/learner/triangulation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from math import factorial, sqrt
55

66
import scipy.spatial
7+
from numpy import abs as np_abs
78
from numpy import (
8-
abs,
99
array,
1010
asarray,
1111
average,
@@ -17,7 +17,7 @@
1717
square,
1818
subtract,
1919
)
20-
from numpy import sum as nsum
20+
from numpy import sum as np_sum
2121
from numpy import zeros
2222
from numpy.linalg import det as ndet
2323
from numpy.linalg import matrix_rank, norm, slogdet, solve
@@ -163,7 +163,7 @@ def circumsphere(pts):
163163
return fast_3d_circumcircle(pts)
164164

165165
# Modified method from http://mathworld.wolfram.com/Circumsphere.html
166-
mat = array([[nsum(square(pt)), *pt, 1] for pt in pts])
166+
mat = array([[np_sum(square(pt)), *pt, 1] for pt in pts])
167167
center = zeros(dim)
168168
a = 1 / (2 * ndet(mat[:, 1:]))
169169
factor = a
@@ -560,7 +560,7 @@ def _relative_volume(self, simplex):
560560
is to check that a simplex is almost flat."""
561561
vertices = array(self.get_vertices(simplex))
562562
vectors = vertices[1:] - vertices[0]
563-
average_edge_length = mean(abs(vectors))
563+
average_edge_length = mean(np_abs(vectors))
564564
return self.volume(simplex) / (average_edge_length ** self.dim)
565565

566566
def add_point(self, point, simplex=None, transform=None):

0 commit comments

Comments
 (0)