On Thursday, 2 October 2014 00:04:16 UTC+3,
c.mila...@gmail.com wrote:
> Öö Tiib wrote:
> > On Wednesday, 1 October 2014 00:13:28 UTC+3,
c.mila...@gmail.com wrote:
> > > Boost.Units supports 12-year-old compilers, while Cpp-Measures
> > > requires, and takes advantage of, the parts of C++11 available
> > > in GCC and VC++ 2012.
> >
> > Yes boost maybe supports too exotic compilers and that makes
> > sometimes its code hard to follow. OTOH the development
> > tools for most electronic devices around us catch up slowly
> > so supporting only few latest compilers may narrow target
> > audience down too lot.
>
> You are right, but I target mainly engineering and scientific
> (but not theoretical physics) software, not small micro-controllers,
> for which C is generally preferred to C++. And I found
> very useful the "decltype" keyword, that I used a lot.
You seemingly say that inside industrial devices or vehicles
(be it bottle washer, crane or ship) there are some sort of
weak 8 bit micro-controllers? No, there are typically piles
of quite powerful processors in all equipment especially where
it has to deal with temperatures, pressures, rotation speeds,
distances, voltages and just name it.
Claiming that software for those must be written in C is like
claiming that engineering or scientific analysis software has
to be written in Fortran.
> > > Boost.Units includes many definitions of magnitudes and units
> > > in the library, while Cpp-Measures requires that the application
> > > programmer defines the needed magnitudes and the units,
> > > although many examples will be available in documentation.
> >
> > Maybe it makes sense to do like boost, standardized systems of
> > dimensions like SI or CGS do not change too often.
>
> Many engineers and scientists use units not belonging
> to standardized systems. Never heard about energy measured
> in electron-volts, or force (not mass) measured in kilograms?
> In addition, having all magnitudes and units
> application-programmer defined keeps small the code base.
Boost.Units doesn't remove opportunity to define your
own exotic units. However on common case we measure things
with standard units and so these are not bad to have as part
of library. More defining and declaring work for user means
more tyops and more inconvenience.
> > > Application code using Cpp-Measures is less verbose.
> > > For example, the following Boost.Units expression
> > >
> > > quantity<absolute<fahrenheit::temperature> >
> > > T1p(32.0*absolute<fahrenheit::temperature>());
> > >
> > > corresponds to the following Cpp-Measures expression
> > >
> > > point1<fahrenheit> T1p(32);
> >
> > Names like "quantity absolute" and "quantity" feel bit
> > more intuitive than "point1" and "vec1" but YMMV.
>
> I feel that, after you have learned that "point1" means
> "one-dimension absolute measure" and "vect1" means
> "one-dimension relative measure", the latter expression
> is more understandable than the former one.
All what I said is that I would avoid enforcing my users to
learn meaning of unknown in most problem domains
abbreviations but your mileage may wary there.
> But as my library is still in development,
> I accept suggestions for a renaming.
What I suggested is to use "relative measure" or "relative
quantity" typed out literally. Note that "one-dimensional"
feels irrelevant for temperature. In what problem domain we
have three-dimensional temperatures? A single value is
indeed technically an array of values with one element but
we usually do not emphasize on that.
> > > Cpp-Measures supports 2-dimensional and 3-dimensional measures,
> > > with algebraic operations, dot product and cross product,
> > > while I couldn't find such features in Boost.Units.
> >
> > I suspect that the existing linear algebra libraries
> > (like Eigen, MTL4, boost.uBLAS or Armadillo) do not integrate
> > neither with your cpp-measures nor with boost.units too well.
> > OTOH it is likely hard to beat performance and quality of such
> > libraries.
> >
> > So instead of building linear algebra into your dimensioned
> > values library it might be worth considering seeking
> > interoperability with one of those. Two good things that
> > play together often result with great outcome.
>
> If you want to represent the position (X=10", Y=12")
> of an object in a plane, and move it by (X=3", Y=8")
> to reach position (X=13", Y=20"),
> using Cpp-Measures you can write:
>
> point2<inches> p(10, 12);
> p += vect2<inches>(3, 8);
> cout << p << endl; // It outputs: 13 20"
That is too far from math that is needed for dealing
with engines pulling around objects that are attached to
each other in real or emulated world (IOW scientific and
engineering applications).
> How can you do that using Boost.Units or another units library
> combined with a vector algebra package?
My impression is that *none* of those linear algebra libraries
and "measures" or "quantities" libraries are designed to play
well together. My suggestion was to do something that stands out
of pack in that respect.
> Cpp-Measures can perform unit checking on 2D and 3D measures,
> while interfacing it with other libraries,
> you lose unit checking, as other libraries
> sometime perform unit-forbidden operations.
Similarly linear algebra library gives compile time
error if you try to multiply 4x4 matrix with 3x3 matrix.
> However, you can interface Cpp-Units with other libraries.
I can interface between anything be it Haskell or Fortran
or Javascript; after all it is C++ (read One Ring) that I
wield. However it is *inconvenient*. Why it must be always
so inconvenient? Why must I always squeeze the bits out of
one library thru badly documented loopholes and then pluck
them into other? Especially when both proudly claim being
meant for my "convenience" of writing scientific and
engineering applications. :D