MAINT: improved polynomial evaluation interface - #243
Merged
Conversation
j-bowhay
force-pushed
the
polyeval_interface
branch
from
August 6, 2026 18:43
ef79547 to
32e44f9
Compare
Member
Author
|
@fbourgey would you mind taking a look :) |
fbourgey
reviewed
Aug 7, 2026
| namespace xsf { | ||
|
|
||
| XSF_HOST_DEVICE inline std::complex<double> cevalpoly(const double *coeffs, int degree, std::complex<double> z) { | ||
| XSF_HOST_DEVICE inline std::complex<double> evalpoly(const double *coeffs, int degree, std::complex<double> z) { |
Member
There was a problem hiding this comment.
What about if degree=0? Should we add a guard
if (degree=0) {
return coeffs[0];
}as coeffs[1] might not exist. The same would apply for the float overload.
Member
Author
There was a problem hiding this comment.
Done - there is quite a bit else that could be done such as checking degree is non-negative and adding standalone tests but I would rather not grow the scope of this PR
Member
|
LGTM, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
What does this implement/fix?
While working on #239 it became quite annoying that there are two completely different functions for evaluating a polynomial with either a real or complex input. This PR introduces a unified
xsf::evalpolywhich has adoubleandstd::complex<double>overload.Additional information
AI Generation Disclosure
No ai