aboutsummaryrefslogtreecommitdiff
path: root/vquad
diff options
context:
space:
mode:
authorChristoph Groth <christoph.groth@cea.fr>2018-01-12 12:21:02 +0100
committerChristoph Groth <christoph.groth@cea.fr>2018-02-23 12:55:00 +0100
commit4c51624ae1e69a2084c012d227cb52289154f8bb (patch)
tree5a8b335062ec2990c60068271d54cfbacbebc11d /vquad
parent781c2a57f4803cbc0cbc0368f9e353fc4d90ca9a (diff)
use insort instead of sort
Diffstat (limited to 'vquad')
-rw-r--r--vquad/core.py10
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