Comments (6)
from mp-units.
from mp-units.
I'm reading between the lines on @viboes message, but I'm often dealing with cameras, and so go from radiance ph/(srm^2sec) to sensor counts through electrons. Neither photons, nor electrons, nor sensor counts appear in typical base unit lists, as they are counts of things (although we're usually interested in expected value, and so floating point values are allowed). It may be worth looking at the kinds of units astropy or YT supports?
Other obvious (to me) dimensionless quantities that are handy are the angle dimensionless quantities. I regularly encounter radians, degrees/minute/seconds, and hours/minutes/seconds as angle measures (ignoring the aforementioned solid angle)
from mp-units.
My current understanding of @viboes question is that there are 2 mixed abstractions here:
-
"Could you confirm the current implementation is uni-dimensional? If yes, Do you plan to manage with multi-dimensions?"
I think that this question is not about
dimensions
in SI sense. SI defines dimensions as:Expression of the dependence of a quantity on the base quantities of a system of quantities as a product of powers of factors corresponding to the base quantities, omitting any numerical factors.
In such a sense every sane physical units library is multi-dimensional as
length
,time
, andvelocity
are separate dimensions in this sense.My understanding of this question is that we are talking here about i.e. space dimensions. For example, if I have a
height
andwidth
(both quantities of dimensionlength
) this library treats both as the same SI dimension and allows all operations on them with no restrictions. I believe that the notion of dimensions in space is orthogonal to this library and a new library could be provided to support this (takingdouble
orunits::quantity<units::metre>
as a Rep parameter). -
Do you plan to manage with dimension-less quantities? Just a counter, as counting the number of potatos.
I know that other libraries implement a dimensionless quantity which basically is implemented as a quantity with an empty dimensions list. Such a quantity behaves differently than any other
quantity
class template instantiation in a way that it can be implicitly converted from/to scalars. In my opinion, this only complicates the design and implementation and provides the users a false immersion of safety (we are dealing here with a strong type, right?) (i.e.mach_number + refractive_index
is a valid operation). This is why the library right now returnsScalar
from division operation on the same dimensions (i.e.4m / 2m == 2
). This follows the idea of "If you behave like a scalar, just use scalar".However, as SI spec says:
The measurement units and values of quantities of dimension one are numbers, but such quantities convey more information than a number
I can revise that with returning a type that actually provides strong type safety with which
mach_number + refractive_index
will not compile. This, however, has some other issues so I am not sure if we should strive for this:auto q1 = 10mps * 2s; // length auto q2 = q1 / 2m; // dimensionless<length> auto q3 = 10mps * 2s / 2m; // dimensionless<velocity>
from mp-units.
For (2) see #27
from mp-units.
Could you confirm the current implementation is uni-dimensional?
I have a feeling that this wasn't a question about restricting operations with width
and height
, but more about vector quantities. Like, does the library allow us to have a 3-dimensional velocity vector in kph or do we have to create a vector with 3 components each being an independent quantity? If that's the case, I would point to a relevant discussion in #23.
from mp-units.
Related Issues (20)
- Should `quantity_point_like_traits` work on raw values?
- Consider using two types instead of values for the template parameters of the `reference` type HOT 1
- Bikeshedding `force_in(Unit)` HOT 10
- Change `mp-units/2.1.0` to `mp-units/2.0.0` in Conan installation steps? HOT 2
- Add support for easier math expressions in `mp-units/math.h` HOT 17
- Should we allow deriving from system entities? HOT 2
- No 2.1.0 in Conan center HOT 3
- ice_point definition is (very very slightly) incorrect
- Do we really need ASCII-only text output? HOT 13
- Text input support
- formatting/printing vector of quantities results in compile time error HOT 3
- Bazel build system support HOT 3
- Should conversions from the raw numerical value to a dimensionless quantity with a unit one be allowed? HOT 26
- Is mp-units targeting freestanding implementations HOT 6
- Provide `wchar_t` support for text output
- Effectively global unit names like 'm' are problematic HOT 35
- compilation time and how to improve it HOT 17
- Can't compile with localization disabled HOT 1
- Can't compile with exceptions disabled HOT 1
- Linker error with base units for "numerical_value_in()" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mp-units.