Skip to content

Commit da3a938

Browse files
author
John Halloran
committed
perf: remove unused derivatives from apply_interpolation
1 parent 38bbb00 commit da3a938

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/diffpy/snmf/snmf_class.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def update_weights(self):
653653

654654
# Populate t using apply_interpolation
655655
for k in range(self.n_components):
656-
t[:, k] = apply_interpolation(self.stretch[k, m], self.components[:, k])[0].squeeze()
656+
t[:, k] = apply_interpolation(self.stretch[k, m], self.components[:, k]).squeeze()
657657

658658
# Solve quadratic problem for y
659659
y = self.solve_quadratic_program(t=t, m=m)
@@ -780,6 +780,7 @@ def apply_interpolation(a, x):
780780
intr_x_tail = np.full((x_len - len(idx_int), interpolated_x.shape[1]), interpolated_x[-1, :])
781781
interpolated_x = np.vstack([interpolated_x, intr_x_tail])
782782

783+
"""
783784
# Compute first derivative (d_intr_x)
784785
di = -idx_frac / a
785786
d_intr_x = x[idx_int] * (-di) + x[np.minimum(idx_int + 1, x_len - 1)] * di
@@ -789,5 +790,6 @@ def apply_interpolation(a, x):
789790
ddi = -di / a + idx_frac * a**-2
790791
dd_intr_x = x[idx_int] * (-ddi) + x[np.minimum(idx_int + 1, x_len - 1)] * ddi
791792
dd_intr_x = np.vstack([dd_intr_x, np.zeros((x_len - len(idx_int), dd_intr_x.shape[1]))])
793+
"""
792794

793-
return interpolated_x, d_intr_x, dd_intr_x
795+
return interpolated_x # , d_intr_x, dd_intr_x

0 commit comments

Comments
 (0)