Skip to content

Commit

Permalink
use legval in _specfuncs.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
terasakisatoshi committed Dec 12, 2024
1 parent c5ad724 commit 0596cce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/sparseir/poly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class PiecewiseLegendrePoly {
double x_tilde;
std::tie(i, x_tilde) = split(x);
Eigen::VectorXd coeffs = data.col(i);
double value = legval(x_tilde, coeffs) * norms[i];
// convert coeffs to std::vector<double>
std::vector<double> coeffs_vec(coeffs.data(), coeffs.data() + coeffs.size());
double value = legval<double>(x_tilde, coeffs_vec) * norms[i];
return value;
}

Expand Down Expand Up @@ -305,6 +307,7 @@ class PiecewiseLegendrePoly {
int get_polyorder() const { return polyorder; }

private:
/*
// Helper function to compute legval
static double legval(double x, const Eigen::VectorXd &coeffs)
{
Expand All @@ -324,6 +327,7 @@ class PiecewiseLegendrePoly {
}
return result;
}
*/

// Helper function to split x into segment index i and x_tilde
std::pair<int, double> split(double x) const
Expand Down

0 comments on commit 0596cce

Please sign in to comment.