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

jmh530 john.michael.hall at gmail.com
Tue Mar 13 14:13:02 UTC 2018


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:
>> On Tuesday, 13 March 2018 at 10:35:15 UTC, 9il wrote:
>>> On Tuesday, 13 March 2018 at 04:35:53 UTC, jmh530 wrote:
>>>> [snip]
>>>>
>>>> What's TMMat?
>>>
>>> TMat is a transposed matrix. Not sure for now if it would be 
>>> required.
>>>
>>
>> There are some people who like being able to specify a whether 
>> a matrix has column or row layout. Would an option to control 
>> this be the same thing?
>
> 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...

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

Numpy does the same thing at run-time
https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html

Also, many of the languages that emphasize linear algebra 
strongly (Fortran, Matlab, etc) use column-major order. Row-order 
is most popular coming from C-based languages.
https://en.wikipedia.org/wiki/Row-_and_column-major_order


More information about the Digitalmars-d mailing list