linalg icon indicating copy to clipboard operation
linalg copied to clipboard

General implementation of `vec<T,M>` and `mat<T,M,N>`

Open sgorsten opened this issue 9 years ago • 4 comments

Presently, vec<T,M> is only defined for M equal to 2, 3, or 4, and mat<T,M,N> is only defined for M and N equal to 2, 3, or 4. This is mainly to allow for the presence of member variables x, y, z, and w when appropriate, and to allow for construction using the {x,y,z} syntax.

Should we also provide a general implementation of vec and mat which would handle sizes greater than four? These could simply use a backing array (or perhaps std::array). They would not support element access with .x, .y, etc., but would support access by array index, as well as all other functions and operators.

sgorsten avatar Feb 28 '16 23:02 sgorsten

Quick comment on this. Eigen allows access via .x() -like methods to support any length. It might work for you that way.

xelatihy avatar Nov 24 '16 13:11 xelatihy

Any update on this? I have tried myself, but it is very hard to implement properly the constructor {elms} syntax. I would love to see how this could be done for both vectors and matrices.

xelatihy avatar Nov 13 '18 10:11 xelatihy

Yes, please add this!

LudwikJaniuk avatar Nov 16 '18 23:11 LudwikJaniuk

This is critical functionality that I would love to have, even if the general case drops the presence of member variables x, y, z, and w or the curly brace constructor syntax.

woolgathering avatar Jul 16 '21 17:07 woolgathering