Skip to content

Commit

Permalink
PERF: remove python loop from ppev_single
Browse files Browse the repository at this point in the history
  • Loading branch information
attack68 committed Jan 15, 2024
1 parent 32c24f1 commit a61c628
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rateslib/splines.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ def ppev_single(self, x):
\\$(x) = \\sum_{i=1}^n c_i B_{(i,k,\\mathbf{t})}(x)
"""
sum = 0
for i, c_ in enumerate(self.c):
sum += c_ * bsplev_single(x, i, self.k, self.t)
return sum
_ = np.array([
bsplev_single(x, i, self.k, self.t) for i in range(self.n)
])
return np.dot(_, self.c)

def ppev(self, x):
"""
Expand Down

0 comments on commit a61c628

Please sign in to comment.