Skip to content

feat: add math/base/tools/normhermitepolyf #2151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 20, 2024

Conversation

C0ldSmi1e
Copy link
Contributor

@C0ldSmi1e C0ldSmi1e commented Apr 11, 2024

Description

What is the purpose of this pull request?

This pull request:

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Apr 11, 2024
@C0ldSmi1e
Copy link
Contributor Author

Test Coverage Report.
image
image

@Planeshifter Planeshifter self-requested a review April 14, 2024 01:00
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment; otherwise this looks all good to me. Thank you for working on this!

@C0ldSmi1e
Copy link
Contributor Author

C0ldSmi1e commented Apr 14, 2024

Hi @Planeshifter @kgryte , I've converted float16 to float32 in runner.py.

Initially I used float16 was because, if I borrow the generator from normhermitepoly, or use float32, test cases can be so small that the variables can be Infinity and thus NaN. So I tried to reduce the data scale a bit to avoid this situation. Now I use float32 and change 1.0 to 0.1, which can also pass the test and is more reasonable.

Please review it again when you are convenient, thanks for your time and support!

@kgryte
Copy link
Member

kgryte commented Apr 14, 2024

@daniel777y Not sure I follow on "test cases can be so small that the variables can be Infinity and thus NaN".

@C0ldSmi1e
Copy link
Contributor Author

C0ldSmi1e commented Apr 14, 2024

@daniel777y Not sure I follow on "test cases can be so small that the variables can be Infinity and thus NaN".

Hi, @kgryte . The failures are mainly from random n and x, small positive and small negative cases. I also gave my thoughts here.

The process is in the middle of the calculation, some x * y2, i * y3 can exceed the range of float32, and if convert them to float32, they will be Infinity or -Infinity. The next line s1 - s2 can be NaN.

for ( i = n; i > 1; i-- ) {
    s1 = float64ToFloat32( x * y2 );
    s2 = float64ToFloat32( i * y3 );
    y1 = float64ToFloat32( s1 - s2 );
    y3 = y2;
    y2 = y1;
}

What is the best practice to deal with this issue?

@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Apr 20, 2024
@kgryte
Copy link
Member

kgryte commented Apr 20, 2024

@daniel777y After looking at the code, your reasoning is sound. Fine with how you adjusted things.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks, @daniel777y!

@kgryte kgryte merged commit 3c7bd5e into stdlib-js:develop Apr 20, 2024
@C0ldSmi1e
Copy link
Contributor Author

@kgryte Thank you! I learned a lot from it, and look forward to working more on this community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. Math Issue or pull request specific to math functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: add math/base/tools/normhermitepolyf
4 participants