DIP80: phobos additions

via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 14 01:00:02 PDT 2015


On Sunday, 14 June 2015 at 02:56:04 UTC, jmh530 wrote:
> On Saturday, 13 June 2015 at 11:18:54 UTC, Ola Fosheim Grøstad 
> wrote:
>>
>> I think linear algebra should have the same syntax for small 
>> and large matrices and switch representation behind the scenes.
>
> Switching representations behind the scenes? Sounds complicated.

You don't have much of a choice if you want it to perform. You 
have take take into consideration:

1. hardware factors such as SIMD and alignment

2. what is known at compile time and what is only known at runtime

3. common usage patterns (what elements are usually 0, 1 or a 
value)

4. when does it pay off to encode the matrix modifications and 
layout as meta information (like transpose and scalar 
multiplication or addition)

And sometimes you might want to compute the inverse matrix when 
doing the transforms, rather than as a separate step for 
performance reasons.

> I would think that if you were designing it from the ground up, 
> you would have one general matrix math library. Then a graphics 
> library could be built on top of that functionality. That way, 
> as improvements are made to the matrix math functionality, the 
> graphics library would benefit too.

Yes, but nobody wants to use a matrix library that does not 
perform close to the hardware limitations, so the representation 
should be special cased to fit the hardware for common matrix 
layouts.


More information about the Digitalmars-d mailing list