-
Notifications
You must be signed in to change notification settings - Fork 90
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
Vector quantities with units #439
Comments
If you want to use uniform vectors where each entry has the same physical unit then there are easier solutions, the V1 doc contained code examples for this, not sure if they are still part of the documentation. |
As @dwith-ts mentioned, in cases where all quantities in the vector/matrix store the same type, then it works nicely already. See https://mpusz.github.io/units/use_cases/linear_algebra.html. It gets tricky when you want to use various types in a matrix (i.e. kalman filters), but this is a limitation of the LA library and not mp-units. In such cases, an additional level of abstraction will be needed as mentioned by Daniel Withopf in his talk. |
I also plan to provide examples with BLAS-based LA and SIMD which both were proposed for standardization recently. |
Yes, I think you can get away with components-as-quantities for vectors, (which might also imply "cartesian", BTW). Also, I am hesitant about the implicit equivalency (ambiguity?) between components-as-quantities and vector-as-quantity: I have my own library for arrays (dynamic, arbitrary static dimension), https://gitlab.com/correaa/boost-multi. Any feedback is welcome, BTW. In any case, I expect it to be used as a backend (representation) of linear algebra, I want it to be compatible with linear algebra applications (and also with units). |
I think we might support such an equivalency. Please note that ISO 80000-2 explicitly states:
|
That would be a bold move, indeed. It probably makes sense because, in linear algebra, indexing can be seen as a linear operator. I tried to hack Boost.Units to make that work, but I think I gave up. I hope it goes well. ... and that it doesn't open a can of worms (e.g., what if
You are taking this seriously. 👍
Interesting, I do that all the time, of course, but I didn't know I was allowed by ISO. (Indeed, using units over vectors/components implies cartesian components, in contrast to components on a non-orthogonal basis.) I guess it is risky to take ISO as a source of mathematical knowledge (mathematics by committee?), but it does point in a reasonable direction in this case. |
The equivalency only makes sense for uniform vectors. As soon as we have non-uniformity it will no longer work. This also shows that this is not a mathematical relationship in the general case, it is merely a notational convenience for this special case. |
Do you have any strategy or plans to support units for vectors? (Let's say non-dynamically sized vectors.)
For example, I have a position in 3D space that can be in Angstroms or Bohr units (or meters and inches).
Have you put some thought into it?
I know the question is tricky because it is not the vector components or the vector as a whole that carries the units but the "metric tensor", but still.
I find the approach in https://www.youtube.com/watch?v=J6H9CwzynoQ [Daniel Withopf - Physical Units for Matrices] overly complicated, but perhaps it is unavoidable to do it that way.
The text was updated successfully, but these errors were encountered: