Matrix API support - start with formats?

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 13:11:15 PDT 2015


On Friday, 14 August 2015 at 18:51:51 UTC, David Nadlinger wrote:
>
>> If anything I think small vectors, non-sparse matrixes and 
>> rectangles/AABB could be part of Phobos before that.
>
> If you just had a go at it from the CG/gamedev perspective, 
> you'd probably end up with an API that is entirely unsuitable 
> for larger problems. This might not be a big issue (just have 
> two separate APIs), but we'd need to make it a conscious 
> decision.

While I'm interested in working with big (500,000+) dense (and 
sometimes smaller sparse) rectangular matrices, my sense of the D 
forum is that there are more CG/gamedev people using D.

Nevertheless, I think it is important to get the general 
structure right in a way that can be specialized to work with 
small matrices, rectangular matrices, strided matrices, or sparse 
matrices. I don't see an issue with prioritizing what users want 
in terms of fleshing out the APIs, so long as the different ways 
people use matrix libraries is in the back of the designers minds 
when they design it.

I was looking over some of the OpenGL matrix libraries recently. 
They have types like mat4 or vec3. I couldn't help but think that 
template constraints (at least for static arrays) would probably 
make it much easier. For instance, if you have a function that 
takes a vec, you can specialize it to do different things 
depending on if the array is small or large (small, unroll loops, 
large use parallelism, maybe with the decision on when stop 
unrolling loops or starting to use parallelism determined by 
AEOS, as in ATLAS).



More information about the Digitalmars-d mailing list