-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add MatrixX class #442
Add MatrixX class #442
Conversation
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
I'm leaning against I think we could compose a |
I'm inclined to agree with @scpeters on reproducing Eigen functionality. In this case, My main concern would be that we are missing out on a lot of testing/optimizations that Eigen has already gone through for multiple platforms (hardware and OS). |
That feels a bit too specific to me. Hydrodynamic added mass is one use case for exposing all the fields of a spatial mass matrix, but I can imagine other advanced users may want to directly tweak those fields as well. Drake and DART are just two examples of engines that expose the full spatial tensor without making it specific to hydrodynamics. If a
Yeah but SDFormat doesn't, and neither does the
Yeah definitely, and that's also true for all our existing vector and matrix classes.
I hear you. But to summarize the comments above, the choices I see here are:
|
Signed-off-by: Louise Poubel <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-math6 #442 +/- ##
==========================================
Coverage 99.65% 99.66%
==========================================
Files 67 68 +1
Lines 6392 6477 +85
==========================================
+ Hits 6370 6455 +85
Misses 22 22
Continue to review full report at Codecov.
|
Signed-off-by: Louise Poubel <[email protected]>
I think in this case, having the Matrix is useful. I think, in general, it would be nice if people were using Eigen when possible to actually do computations/manipulations. I understand that we may still need some of our own datatypes for convenience in terms of serialization and interactions with other locations in our APIs, but if we can encourage "jumping out" to Eigen for math heavy operations, I think that would be the ideal mix. |
I believe we've been doing this higher up the stack.
So for completeness, I'll mention my preference would be to go with option 4, but I could compromise for 2. I don't think 1 is a good option and 3 isn't feasible at this moment. @scpeters , please let me know what you think. |
I'm not sure I'd call (1) a workaround. If you look at the implementation of I'm also in favor of encouraging the use of Eigen and using our effort to make that easier to use than to expand our set of classes with a |
I don't consider it a workaround. I'm imagining it more like an extension of the You've indicated that you need something that works for Fortress
I still think there is a place for Is Fortress a hard requirement? It will be problematic to add the hydrodynamic added mass inertial tags to SDFormat 1.9 now that an older version of |
The 6x6 added mass matrix can't be decomposed into semantically meaningful sub parts, see the Hydrodynamic Added Mass Proposal.
Are you proposing also moving the existing
That can be discussed. The |
Sorry I didn't realize you were proposing to modify the existing |
Ouch yeah I forgot that these classes aren't PIMPL'ed. I guess I'll have to target this at Garden then. |
Could you elaborate on that? What's the place for these classes when we're using Eigen throughout our stack? And why should we maintain matrix 3 and 4, but not 6 or X? |
After giving this point a bit more consideration, I still think that this would be clunky. The What I think you really want is a more generic
I get the point that a generic matrix is not the optimal storage for a symmetric matrix. I started an implementation on #447 which is called Even with that, I still feel that a |
since we won't be using Eigen for this; I think I would favor an explicit |
Thanks, @scpeters , I'll open a separate PR with a |
🎉 New feature
Summary
We're coming for you, Eigen! (Well, that's what a lot of people think about
gz-math
... 😆 )We need a
Matrix6d
to implementInstead of copying the existing
Matrix3
andMatrix4
classes, I thought it would be useful to implement a matrix class that can have any size. The size is defined at compile time and can't be changed for a given object, so the matrix can't be dynamically resized.I only implemented very basic functionality, more functions can be added to this class as needed. I think we probably have everything that's needed to implement added mass, but if we don't I can add new functions later.
I experimented with different
std
algorithms to substitute the nested for loops, but they were all too confusing to use with nestedstd::array
. I'm open to suggestions though.TODO
Test it
Take a look at the added tests and run the new example.
Checklist
Updated migration guide (as needed)codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸