Skip to content

Closes #2400: Add arc and hyperbolic trig functions - #2447

Merged
stress-tess merged 5 commits into
Bears-R-Us:masterfrom
jaketrookman:2400_trig
Jun 23, 2023
Merged

stress-tess merged 5 commits into
Bears-R-Us:masterfrom
jaketrookman:2400_trig

Conversation

@jaketrookman

@jaketrookman jaketrookman commented May 19, 2023 •

Copy link
Copy Markdown
Contributor

This PR (Closes #2400) adds:

  • the requested inverse and hyperbolic trig functions
  • angle unit conversion functions
  • testing for int, uint, and float datatypes.

Additional issues have been created to implement where functionality to these functions to more closely match numpy. (#2458 and #2461). This will allow for easy single scalar cases to be put in.

@jaketrookman
jaketrookman marked this pull request as ready for review June 1, 2023 19:42
@jaketrookman
jaketrookman requested a review from hokiegeek2 June 5, 2023 16:43
@jaketrookman jaketrookman changed the title Closes #2400 Add arc and hyperbolic trig functionsi Closes #2400 Add arc and hyperbolic trig functions Jun 5, 2023
@stress-tess stress-tess changed the title Closes #2400 Add arc and hyperbolic trig functions Closes #2400: Add arc and hyperbolic trig functions Jun 5, 2023
@stress-tess
stress-tess requested a review from TheOddCzar789 June 6, 2023 19:04
Comment thread arkouda/numeric.py Resolved
Comment thread arkouda/numeric.py Resolved
Comment thread src/EfuncMsg.chpl Resolved
Comment thread tests/numeric_test.py Resolved
Comment thread src/EfuncMsg.chpl Resolved

@Ethan-DeBandi99 Ethan-DeBandi99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think @pierce314159 covered just about everything. I agree his changes.

@Ethan-DeBandi99 Ethan-DeBandi99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I was a little concerned about some of the typing based on the Chapel documentation, but I pulled it down and everything is working as far as I see. I asked @pierce314159 to double check to make sure I did not miss anything.

Comment thread tests/numeric_test.py Resolved

@stress-tess stress-tess left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

some small stuff mostly in the tests. The way they are set up rn, we end up with all zeros a fair amount of the time. We should also test outliers like 0, inf and -inf and stuff like that

The only other thing is i found some weird behavior with arctan2 while testing. I'm not sure what's causing this

In [16]: ak.arctan2(ak.arange(10), 2**63 + 1)
Out[16]: array([3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931 3.1415926535897931])

In [17]: np.arctan2(np.arange(10), 2**63 + 1)
Out[17]:
array([0.00000000e+00, 1.08420217e-19, 2.16840434e-19, 3.25260652e-19,
       4.33680869e-19, 5.42101086e-19, 6.50521303e-19, 7.58941521e-19,
       8.67361738e-19, 9.75781955e-19])

In [18]: np.arctan2(2**63 + 1, np.arange(10))
Out[18]:
array([1.57079633, 1.57079633, 1.57079633, 1.57079633, 1.57079633,
       1.57079633, 1.57079633, 1.57079633, 1.57079633, 1.57079633])

In [19]: ak.arctan2(2**63 + 1, ak.arange(10))
Out[19]: array([-1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966 -1.5707963267948966])

Comment thread arkouda/numeric.py Resolved
Comment thread tests/numeric_test.py Resolved
Comment thread tests/numeric_test.py Resolved

@stress-tess stress-tess left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few more suggested changes on the tests. I think we should go through them line by line in ipython and make sure the output at each step looks how we expect.

Requesting changes because doing assertListEqual on float pdarrays can result in test failures. So we tend to use assertTrue(np.allclose) instead

Comment thread tests/numeric_test.py Resolved
Comment thread tests/numeric_test.py Resolved
Comment thread tests/numeric_test.py Resolved
@jaketrookman
jaketrookman force-pushed the 2400_trig branch 2 times, most recently from 0ac45b5 to 3cb04f0 Compare June 15, 2023 18:25

@stress-tess stress-tess left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good! nice work

Comment thread tests/numeric_test.py Resolved
Comment thread tests/numeric_test.py Resolved

@Ethan-DeBandi99 Ethan-DeBandi99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One thing with the logic that I found and related testing updates.

Comment thread arkouda/numeric.py Resolved
Comment thread tests/numeric_test.py Resolved
Comment thread arkouda/numeric.py Resolved
Comment thread arkouda/numeric.py Resolved
@stress-tess
stress-tess added this pull request to the merge queue Jun 23, 2023
Merged via the queue into Bears-R-Us:master with commit c5eb42f Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add arc and hyperbolic trig functions

3 participants