Skip to content

Conversation

brorson
Copy link

@brorson brorson commented Sep 6, 2025

This is a request to try the new Mathieu fcn impl. This new fcn impl has been discussed in #47 . I have updated the docstrings and other comment in this checkin, but the functionality has otherwise remained the same as that shown in the bug report.

I have run these fcns against the Scipy test suite using "spin test" and the test suite runs to completion. The Mathieu fcns fail, but that is expected since this is a new impl and the input arg is in radians, not degrees.

Please review and comment. My goal here is to request a review and find out what I need to change.

Stuart

@lucascolley
Copy link
Member

I'm afraid I can't help with C++ expertise, but I wonder whether you could open a draft PR to SciPy which shows the tests running (albeit with failures)? No rush, just thought it might be worth it whilst you are waiting for review here and have some momentum. Let me know if you would like help with making the necessary changes to the SciPy submodule etc.

@brorson
Copy link
Author

brorson commented Sep 7, 2025

Thank you for your suggestion, @lucascolley. I will do that.

Meanwhile, I see the CI thing is running on my PR and I have build failures. I fixed one -- I was using the suffix 'd' when declaring double literals which turns out to be non-standard. I fixed that one and pushed to my forked repo. Not sure if CI runs continuously but I will continue fixing any bugs it finds.

Stuart

@lucascolley
Copy link
Member

It is a GitHub limitation that since this is your first PR, CI runs require approval from someone with write access on the repo.

@brorson
Copy link
Author

brorson commented Sep 10, 2025

OK, I just submitted a PR on the main Scipy branch. The pull request includes:

  1. My changes to the meson.build file which are required to successfully build the Mathieu stuff. The change is imply to add the Lapack dependencies to ufuncs and other build targets per @steppi 's suggestion.
  2. I also mentioned the failing tests. The Mathieu tests now fail since the implementation is different and returns different results from the old impl. (The old tests didn't check correctness; they just checked that the output of the fcns didn't change.) The required action item here is to bypass the tests for the time being so the impls can be integrated into the codebase. I also offer to provide some Python-based tests written by my students which can be used in the future. Maybe it would make sense to have a Scipy branch we can work in and not bother the trunk?

I also submitted a new PR on the xsf repo to pick up a bugfix I implemented after looking at some of my last CI test failures: I had suffixed some double literals using 'd', like this: 2.0d. This is apparently not standard C++ so made some of the compilers barf. My mistake -- I fixed it and issued a new PR to you.

Sorry for the multiple PRs -- I'm new to the Scipy dev chain and so will fumble around a little bit as I try to get this change into the codebase.

Stuart

@steppi
Copy link
Collaborator

steppi commented Sep 10, 2025

Thanks @brorson. I plan to spend some time in the next few weeks to improve testing, and we can add some test cases based on references from https://github.com/mathieuandspheroidalwavefunctions computed with quad precision. In the meantime, your main.c should be moved into the tests folder and turned into a proper Catch2 test file named something like xsf/tests/miscellaneous_tests/test_mathieu_funcs.cpp that will get picked up by the test harness. You don't have to use parquet tables, you can just hardcode the golden values into the test files. Let me know if you need any help with this. If you do this, I can set the tolerances in the relevant tests in xsf/tests/scipy_special_tests to infinity until reference values are recomputed.

@rgommers
Copy link
Member

It is a GitHub limitation that since this is your first PR, CI runs require approval from someone with write access on the repo.

The usual workaround is to open a separate PR fixing a typo or other such trivial thing somewhere in the repo; once that's merged, CI will run here.

@brorson
Copy link
Author

brorson commented Sep 10, 2025

Thank you, @steppi. Regarding the tests in main.c, sure I can move them to a file called "test_mathieu_fcns.cpp" and move them to xsf/tests/miscellaneous_tests/. Give me a day or two.

Once I do that I will check the mods into my GitHub repo and issue another PR so you know they're there.

@brorson
Copy link
Author

brorson commented Sep 10, 2025

@steppi, per your comments I moved the tests from main.c to a file xsf/tests/scipy_special_tests/test_mathieu.cpp in my local directory. But now I am looking at the other cpp files in that dir. It's clear that I need to do some homework and understand the formatting of the test files and how they are processed and then executed. Meanwhile, can I ask you to point me to some test files which are close to my use-case? My near-term goal is to just have a file which is picked up by the CI thing, runs some functions which test against golden values hard-coded into the file, then sets the right variables to tell the CI thing about passes/failures. Is there a particular file or files I can look at as an example?

Thanks,
Stuart

@steppi
Copy link
Collaborator

steppi commented Sep 11, 2025

@steppi, per your comments I moved the tests from main.c to a file xsf/tests/scipy_special_tests/test_mathieu.cpp in my local directory. But now I am looking at the other cpp files in that dir. It's clear that I need to do some homework and understand the formatting of the test files and how they are processed and then executed. Meanwhile, can I ask you to point me to some test files which are close to my use-case? My near-term goal is to just have a file which is picked up by the CI thing, runs some functions which test against golden values hard-coded into the file, then sets the right variables to tell the CI thing about passes/failures. Is there a particular file or files I can look at as an example?

Thanks, Stuart

Thanks. I should have some time tomorrow to write a quick template for how the test file could be written and post it here

main.c to test_mathieu.cpp in the tests dir.  I ran clang-format on all
.h files.
@brorson
Copy link
Author

brorson commented Sep 11, 2025

Thank you.

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.

4 participants