Skip to content

Commit ad65c25

Browse files
author
Martin D. Weinberg
committed
Reduce the number of python function calls
1 parent 70f27ae commit ad65c25

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

expui/BiorthBasis.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4743,6 +4743,8 @@ namespace BasisClasses
47434743

47444744
legendre_R(Lmax, costh, legs[tid]);
47454745

4746+
double fval = func(x, y, z, time);
4747+
47464748
for (int L=0, l=0; L<=Lmax; L++) {
47474749

47484750
for (int M=0; M<=L; M++, l++) {
@@ -4754,13 +4756,10 @@ namespace BasisClasses
47544756

47554757
for (int k=0; k<knots; k++) {
47564758
if (M==0) {
4757-
mat(l, n) += prefac * legs[tid](L, M) * potd[tid](L, n) *
4758-
func(x, y, z, time);
4759+
mat(l, n) += prefac * legs[tid](L, M) * potd[tid](L, n) * fval;
47594760
}
47604761
else {
4761-
double fac = prefac * legs[tid](L, M) * potd[tid](L, n) *
4762-
func(x, y, z, time);
4763-
4762+
double fac = prefac * legs[tid](L, M) * potd[tid](L, n) * fval;
47644763
mat(l, n) += std::complex<double>(cos(phi*M), sin(phi*M)) * fac;
47654764
}
47664765
}
@@ -4841,7 +4840,8 @@ namespace BasisClasses
48414840

48424841
if (R/ASCL>Rtable) continue;
48434842

4844-
double fac = (xmax - xmin)*(ymax - ymin) * 2.0*M_PI/knots * lw.weight(i)*lw.weight(j);
4843+
double fac = (xmax - xmin)*(ymax - ymin) * lw.weight(i)*lw.weight(j) *
4844+
2.0*M_PI/knots * func(x, y, z, time);
48454845

48464846
for (int mm=0; mm<=Mmax; mm++) {
48474847

@@ -4853,7 +4853,7 @@ namespace BasisClasses
48534853
double pC, pS;
48544854
sl->getPotSC(mm, nn, R, z, pC, pS);
48554855

4856-
mat(mm, nn) += std::complex<double>(pC*mcos, pS*msin) * func(x, y, z, time) * fac;
4856+
mat(mm, nn) += std::complex<double>(pC*mcos, pS*msin) * fac;
48574857
}
48584858
}
48594859
}

0 commit comments

Comments
 (0)