diff options
Diffstat (limited to 'vquad/core.py')
| -rw-r--r-- | vquad/core.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vquad/core.py b/vquad/core.py index 7f586f9..23f1c24 100644 --- a/vquad/core.py +++ b/vquad/core.py @@ -3,6 +3,8 @@ # This file is part of Vquad. It is subject to the license terms in the file # LICENSE.rst found in the top-level directory of this distribution. +from bisect import insort + import numpy as np from scipy.linalg import norm @@ -193,8 +195,12 @@ class Vquad: return if split: - self.ivals.extend(self.split(self.ivals.pop())) - self.ivals.sort() + # Replace current interval by its children. + for new in self.split(self.ivals.pop()): + insort(self.ivals, new) + else: + # The error estimate of the current interval has changed. + insort(self.ivals, self.ivals.pop()) def totals(self): igral = self.igral_excess |
