BiorthBasis: use Eigen::Ref for getAccel inputs#173
Conversation
allows Gala to pass a Eigen::Map<Eigen::VectorXd> that wraps a raw pointer
|
Thanks. That looks right to me. I'll do a quick check on an existing notebook that tests |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the getAccel method signatures in the BiorthBasis class to use Eigen::Ref<const T> instead of non-const references, improving API flexibility and const-correctness. The changes allow these methods to accept a wider variety of Eigen types while properly indicating that the input parameters are not modified.
- Changed parameter types from
Eigen::VectorXd&toEigen::Ref<const Eigen::VectorXd>for vector overloads - Changed parameter type from
RowMatrixXd&toEigen::Ref<const RowMatrixXd>for matrix overload - Updated Python bindings to match the new C++ signatures
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| expui/BiorthBasis.H | Updated getAccel method signatures to use Eigen::Ref<const T> parameters for improved const-correctness and flexibility |
| pyEXP/BasisWrappers.cc | Updated Python binding py::overload_cast templates to match the new C++ method signatures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
My checks all work as expected. Merging... |
In Gala, we have raw pointers and want to call the array overload for
getAccel, so we're usingEigen::Maplike so:This currently doesn't work because the
getAccelargs must beVectorXd, notMap. This PR changes the API to acceptMaps by changing the input types toEigen::Ref<const Eigen::VectorXd>.