Simple and small performance improvements

This commit is contained in:
Grant Sanderson
2018-08-18 20:13:49 -07:00
parent 6f57a8bc5e
commit 039f7ffe58
3 changed files with 29 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import numpy as np
from scipy import linalg
from utils.simple_functions import choose
from utils.simple_functions import choose_using_cache
from utils.space_ops import get_norm
CLOSED_THRESHOLD = 0.001
@ -10,7 +10,7 @@ CLOSED_THRESHOLD = 0.001
def bezier(points):
n = len(points) - 1
return lambda t: sum([
((1 - t)**(n - k)) * (t**k) * choose(n, k) * point
((1 - t)**(n - k)) * (t**k) * choose_using_cache(n, k) * point
for k, point in enumerate(points)
])