Skip to content

Commit

Permalink
NonnormalAuto: avoid duplicate points due to round-off errors
Browse files Browse the repository at this point in the history
  • Loading branch information
André Gaul committed Apr 10, 2014
1 parent 8901d3a commit 477c79f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pseudopy/nonnormal.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,21 @@ def sort(lambd):
# construct points for evaluation of resolvent
points = []
arg = numpy.linspace(0, 2*numpy.pi, n_points, endpoint=False)

for midpoint, radius_max in zip(midpoints, radii):
radius_log = numpy.logspace(numpy.log10(eps_min),
numpy.log10(radius_max),
n_circles
)

#radius_lin = numpy.linspace(eps_min, radius_max, n_circles)
for radius in radius_log:
rand = 0.
if randomize:
rand = numpy.random.rand()
points.append(midpoint + radius*numpy.exp(1j*(rand+arg)))

# check that radius is larger than round-off in order to
# avoid duplicate points
if numpy.abs(radius)/numpy.abs(midpoint) > 1e-15:
points.append(midpoint + radius*numpy.exp(1j*(rand+arg)))
points = numpy.concatenate(points)
super(NonnormalAuto, self).__init__(A, points, **kwargs)

0 comments on commit 477c79f

Please sign in to comment.