Is there anybody working on a linear algebra library for D2?

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Oct 6 02:32:47 PDT 2010


On Tue, 05 Oct 2010 15:01:03 +0000, dsimcha wrote:

> == Quote from jcc7 (jccalvarese at gmail.com)'s article
>> == Quote from Michael Chen (sth4nth at gmail.com)'s article
>> > I remember that one of D's goal is easy scientific computation.
>> > However I haven't seen any linear algebra package for D2. My work
>> > heavily relays on all kinds of matrix stuff (matrix multiplication,
>> > factorization, linear system etc). I like D and am willing to work
>> > with D. However without these facilities I can hardly start. I'd like
>> > to have a matrix library of which the API is kind of like Matlab. Is
>> > there anybody working on this or planning to work on this? Regards,
>> > Michael
>> You might be able to find something useful for you in this list on this
>> page: http://www.prowiki.org/wiki4d/wiki.cgi?ScientificLibraries (You
>> might not be able to find a D 2.x project for what you need, but it
>> might
> not be much effort to
>> make a minimal port from a D 1.x project.) Good luck.
>> jcc7
> 
> Lars Kyllingstad's SciD library (http://dsource.org/projects/scid) is a
> good work in progress.  Unfortunately it depends heavily on Blas and
> Lapack.  I haven't figured out how to set these up on Windows yet. 
> However, it's definitely off the ground and looks pretty usable for
> those wizards sufficiently skilled in the art of fiddling with linker
> settings to get crufty old C and Fortran libraries to link with D code.

Let me just start off by saying that if you are using Linux, there's less 
need for fiddling and wizardry. :)  On a 32-bit system the libraries 
should be available through your package manager, and all you need to do 
is to pass the -L-lblas and -L-llapack switches to DMD.  On a 64-bit 
system you may have to download them manually, but after that it's only a 
matter of telling DMD where to find them with -L-L/location/of/libs.

But I have to admit, the linear algebra stuff in SciD is fairly limited.  
I've mostly added stuff whenever I've needed it for work.  There's no 
full-fledged matrix type, just the scid.matrix.MatrixView type which 
provides a two-dimensional view (i.e. only getting and setting elements 
supported, no arithmetic) on an ordinary D array.  In addition, there's 
the scid.linalg package which provides user-friently interfaces to a few 
LAPACK algorithms.


> IMHO there should eventually be pure D versions of this functionality. 

I completely agree.  More annoying than figuring out the BLAS/LAPACK 
library setup, which you only have to do once, is the fact that BLAS and 
LAPACK don't have support for the real and Complex!real types.


> I tried to get started writing it, but got sidetracked by about a
> million other things.

I see a real need for this, so when I get the time, and if dsimcha (or 
anyone else) doesn't beat me to it, I'll probably start working on this 
myself.

-Lars


More information about the Digitalmars-d mailing list