Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

9il ilyayaroshenko at gmail.com
Tue Mar 13 16:40:13 UTC 2018


On Tuesday, 13 March 2018 at 14:13:02 UTC, jmh530 wrote:
> On Tuesday, 13 March 2018 at 13:02:45 UTC, Ilya Yaroshenko 
> wrote:
>> On Tuesday, 13 March 2018 at 12:23:23 UTC, jmh530 wrote:
>>> [...]
>>
>> Good point. Would matrix(j, i) syntax solve this issue? One of 
>> reasons to introduce Mat is API simplicity. ndslice has 3 
>> compile time params. I hope we would have only type for Mat, 
>> like Mat!double.
>
> I'm not sure I understand what your syntax solution does...

matrix(j, i) == matrix[i, j] (reversed order)

> But I agree that there is a benefit from API simplicity. It 
> would probably be easier to just say Mat is row-major and have 
> another that is column-major (or have the options in ndslice). 
> Nevertheless, it can't help to look at what other matrix 
> libraries do.
>
> Eigen's (C++ library) Matrix class uses template arguments to 
> set storage order (_Options). It looks like Eigen has six 
> template arguments.
> https://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html

Interesting.  Maybe user can do:

alias Mat = Matrix!(double, ColMajor);

Fixed lengths can be considered too. Eigen has good ideas.


More information about the Digitalmars-d mailing list