MathExp: KISS or All-Out?

Bill Baxter wbaxter at gmail.com
Fri Oct 16 14:30:37 PDT 2009


On Fri, Oct 16, 2009 at 2:57 AM, Fawzi Mohamed <fmohamed at mac.com> wrote:
> On 2009-10-16 11:13:59 +0200, gzp <galap at freemail.hu> said:
>
>> language_fan írta:
>>>
>>> Thu, 15 Oct 2009 02:04:09 -0400, Chad J thusly wrote:
>>>
>>>> I'm reminded of how annoying it is when there are different libraries
>>>> for a language that all define their mathematical types differently and
>>>> in incompatible ways (all of the Vec2D, Vec3D, etc ever).  Also
>>>> aggravating is when there is one canonical type that everyone uses, but
>>>> it is a poor choice (char* in C for strings).
>>>>
>>>
>>> Sometimes it feels like Vec3 must be the most reimplemented wheel on the
>>> world.
>>
>> Yes, i've also started to implement my own matrix/vector library, though
>> could not get too far yet, as I have to learn D meanwhile. I've checked some
>> existing ones (ex. Lyla, and some other on dsource - don't remember the
>> name, sorry), but my main problem was that,
>>
>>  - the implementation could not be altered as desired (ex. I need a sparse
>> matrix, where the matrix elements grouped using a quad-tree )
>>  - didn't like the coding style ( ex. "_" in function names). In some
>> previous post there was some discussion about this and from my experiences
>> even though we found libraries that has all the capability we required, we
>> did not used them. Sometimes we didn't used our colleagues (good,
>> well-planned) codes either b/c the style differed so much (ex capital
>> letters, "_", m prefix for members etc.) So if a language can enforce a
>> style (at least giving some warnings - and turning on treat warnings as
>> errors :) ), that really helps to reuse codes. Well, it's another topic...
>>  - too general where it is not required for me, but could not extend where
>> it is needed for me
>>  - seemed to be hard to implement a "general" n-d geometry lib based on
>> them(ex 2d/3d/nd ray, sphere, plane, etc, simplicals, space partitioning in
>> n-d etc.)
>>
>> So it'd be really great to create a "new" d mathematical library, that is
>> developed and discussed by a group.
>>
>> Ok, I know there are wrappers for BLAS and other C libraries, but I'd like
>> to see a library written entirely in D.
>
> I think you are greatly underestimating the effort of making "just a library
> for matrixes and vectors"
>
> I think that there are at least 3 areas that have quite different tradeoffs:
> * small vectors/matrixes, fixed size
> * large dense vector/matrixes
> * sparse matrixes/vectors
>
> I did just dense matrixes, in blip, and blas is used if available to speed
> up things when possible (default, use version noBlas noLapack to avoid using
> it), lapack to implement more complex linear algebra stuff.
>
> For sparse matrixes Bill has hidden them in the multiarray project,

Wasn't really my intention to hide them :-)... but yes they are there
in the "dflat" package of multiarray.

> the
> multiarray implementation there is quite slow and has some shortcomings, but
> it hasn't been the focus of bill since a long time.

Yeh, don't use the multiarray in the multiarray project.  dflat is for
sparse and dense matrices and is independent of multiarray.

> But he has wrappers for sparse matrixes, and several sparse matrix libs that
> he actively uses.

Well less actively these days since I changed jobs.  But as you can
see, I still hang around here anyway, just waiting for the day D
declares victory.

> for small vectors/matrixes I use open math for games (omg) implementation.

Best named math library evar, probly. lol.

--bb



More information about the Digitalmars-d mailing list