www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Learning by Doing: dimensioning units or geometric algebra?

reply "Joel C. Salomon" <joelcsalomon gmail.com> writes:
Hello all,

I’m a C programmer with some C++ experience (“C with Classes”+STL
anyway; never did implement anything but the most trivial templates) and
I’m looking to get stated with D. I figured a good way to do that would
be to implement a template library, and it may as well be something I’ll
actually use. Here’s what I’m thinking I could make:

• a library for dimensional analysis, like boost::units, and/or
• a set of classes for 2-dimensional Geometric Algebra (scalars,
vectors, and pseudoscalars/imaginary numbers).

(Not to get into a discussion of GA, but its an algebra of scalars,
vectors, &c. with dot products, wedge products (related to the cross
product, but nicer) and a non-commutative “geometric product”. It’s
useful in computer graphics and aerospace control because it has a much
nicer approach to rotations than using matrices.)

Should I start with D1 for now, or jump right in to D2?

Any clues as to which project will get me started with the language faster?

—Joel Salomon
Feb 03 2009
next sibling parent reply Bill Baxter <wbaxter gmail.com> writes:
On Wed, Feb 4, 2009 at 6:45 AM, Joel C. Salomon <joelcsalomon gmail.com> wr=
ote:
 Hello all,

 I'm a C programmer with some C++ experience ("C with Classes"+STL
 anyway; never did implement anything but the most trivial templates) and
 I'm looking to get stated with D. I figured a good way to do that would
 be to implement a template library, and it may as well be something I'll
 actually use. Here's what I'm thinking I could make:

 =95 a library for dimensional analysis, like boost::units, and/or
I always found this kind of thing boring, also I see it as kind of useless overhead that I don't want in my calculations. But it could be a nice way to get your feet wet.
 =95 a set of classes for 2-dimensional Geometric Algebra (scalars,
 vectors, and pseudoscalars/imaginary numbers).
This would be very interesting. The topic of GA did come up a few weeks ago here. From what I understand about GA, it's elegant from the math point of view, but in terms of writing efficient code it doesn't fare so well. D can do a lot of stuff with ease at compile-time that C++ couldn't even dream of, so it would be a great showcase for D if someone could figure out how to make a GA lib that rivals the performance of a classic mats & vecs approach. I don't really know if it is possible. Maybe the cost of the GA abstractions cannot be automatically eliminated like that. But if not it would be interesting to know why.
 Should I start with D1 for now, or jump right in to D2?
D1 will give you the opportunity to build on more existing libraries. D2 will give you the opportunity to use fancy new features that aren't available in D1. D2 will also likely break your code at some point as the D2 language evolves. D1 will not (should not anyway). --bb
Feb 03 2009
parent BCS <none anon.com> writes:
Hello Bill,

 On Wed, Feb 4, 2009 at 6:45 AM, Joel C. Salomon
 
 • a library for dimensional analysis, like boost::units, and/or
 
I always found this kind of thing boring, also I see it as kind of useless overhead that I don't want in my calculations. But it could be a nice way to get your feet wet.
if done right there should be no run time overhead
Feb 03 2009
prev sibling parent BCS <none anon.com> writes:
Hello Joel,

 Hello all,
 
 I'm a C programmer with some C++ experience ("C with Classes"+STL
 anyway; never did implement anything but the most trivial templates)
 and I'm looking to get stated with D. I figured a good way to do that
 would be to implement a template library, and it may as well be
 something I'll actually use. Here's what I'm thinking I could make:
 
 . a library for dimensional analysis, like boost::units, and/or 
 . a set of classes for 2-dimensional Geometric Algebra (scalars, vectors,
 and pseudoscalars/imaginary numbers).
 
I'd suggest going with the GA option as I don't remember seeing one and I know of at least 3 units libs: 1 runtime and 2 compile time. In full disclosure, I wrote one of each of those. The only one I can find now is my compile time one: http://www.dsource.org/projects/scrapple/browser/trunk/units
 Should I start with D1 for now, or jump right in to D2?
As for me I'd stick with 1.0 as it is more stable and for the above stuff good enough. But that's just me.
 -Joel Salomon
 
Feb 03 2009