refactor(thetaSeriesExpansion): marked parameters as const

This commit is contained in:
2025-04-21 09:09:09 -04:00
parent 513e90b7a0
commit 1af5bd00a2
2 changed files with 6 additions and 6 deletions

View File

@@ -41,14 +41,14 @@
namespace laneEmden {
double a (int k, double n) { // NOLINT(*-no-recursion)
double a (const int k, const double n) { // NOLINT(*-no-recursion)
if ( k == 0 ) { return 1; }
if ( k == 1 ) { return 0; }
else { return -(c(k-2, n)/(std::pow(k, 2)+k)); }
}
double c(int m, double n) { // NOLINT(*-no-recursion)
double c(const int m, const double n) { // NOLINT(*-no-recursion)
if ( m == 0 ) { return std::pow(a(0, n), n); }
else {
double termOne = 1.0/(m*a(0, n));
@@ -60,7 +60,7 @@ namespace laneEmden {
}
}
double thetaSeriesExpansion(double xi, double n, int order) {
double thetaSeriesExpansion(const double xi, const double n, const int order) {
double acc = 0;
for (int k = 0; k < order; k++) {
acc += a(k, n) * std::pow(xi, k);

View File

@@ -33,9 +33,9 @@
namespace laneEmden {
double a (int k, double n);
double c(int m, double n);
double thetaSeriesExpansion(double xi, double n, int order);
double a (const int k, const double n);
double c(const int m, const double n);
double thetaSeriesExpansion(const double xi, const double n, const int order);
}
// Struct to persist lifetime of the linear and nonlinear solvers