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

Sam Potter sfp at umiacs.umd.edu
Wed Mar 14 17:22:16 UTC 2018


On Wednesday, 14 March 2018 at 16:16:55 UTC, Andrei Alexandrescu 
wrote:
>> Maybe we should use only column major order. --Ilya
>
> Has row-major fallen into disuse?

Leaving aside interop between libraries and domains where row 
major is often used (e.g. computer graphics), the issue is 
semantic, I think. AFAIK, basically all "modern" domains which 
involve linear algebra ("data science", machine learning, 
scientific computing, statistics, etc.) at least formulate their 
models using the standard linear algebra convention, which is to 
treat vectors as column vectors (column major). It seems, at 
least tacitly, that this question is partly about whether to 
treat this use case as a first-class citizen---column vectors are 
the norm in these areas.

It's great to have flexibility at the low level to deal with 
whatever contingency may arise, but it seems that it might be 
worth taking a page out of MATLAB/numpy/Julia's book and to try 
to make the common case as easy as possible (what you were 
alluding to with a "common data language", I think). This seems 
to match the D notion of having "high torque". Start with svd(X) 
and ramp up as necessary.

Along these lines, including a zoo of different types of 
hypermatrices (triangular, banded, sparse, whatever) is cool, but 
the common cases for plain ol' matrices are dense, sparse, 
diagonal, triangular, Toeplitz, etc. Ideally data structures and 
algorithms covering this would be in the standard library?

Also, I think Armadillo is an extremely nice library, but even it 
can be a little frustrating and clunky at times. Another case 
study: the Python scientific toolchain (numpy/scipy/matplotlib) 
seems to be going in the direction of deprecating "ipython 
--pylab" (basically start ipython in a MATLAB compatibility mode 
so that typing typical MATLAB commands "just works"). This seems 
to me to be a huge mistake---the high-level "scripting mode" 
provided by "ipython --pylab" is extremely valuable.

This comment is coming from someone who has been sitting by the 
edge of the pool, waiting to hop in and check out D as a 
replacement for a combination of C++/Python/Julia/MATLAB for 
research in scientific computing. Take all this with a grain of 
salt since I haven't contributed anything to the D community. :^)


More information about the Digitalmars-d mailing list