5

Here is a good linear solver named GotoBLAS. It is available for download and runs on most computing platforms. My question is, is there an easy way to link this solver with the Mathematica kernel, so that we can call it like LinearSolve? One thing most of you may agree on for sure is that if we have a very large Linear system then we better get it solved by some industry standard Linear solver. The inbuilt solver is not meant for really large problems.

Now that Mathematica 8 has come up with better compilation and library link capabilities we can expect to use some of those solvers from within Mathematica. The question is does that require little tuning of the source code, or you need to be an advanced wizard to do it. Here in this forum we may start linking some excellent open source programs like GotoBLAS with Mathematica and exchange our views. Less experienced people can get some insight from the pro users and at the end we get a much stronger Mathematica. It will be an open project for the ever increasing Mathematica community and a platform where these newly introduced capabilities of Mathematica 8 could be transparently documented for future users.

I hope some of you here will give solid ideas on how we can get GotoBLAS running from within Mathematica. As the newer compilation and library link capabilities are usually not very well documented, they are not used by the common users very often. This question can act as a toy example to document these new capabilities of Mathematica. Help in this direction by the experienced forum members will really lift the motivation of new users like me as well as it will teach us a very useful thing to extend Mathematica's number crunching arsenal.

4
  • 2
    Look at MathLink. It is easy to learn.
    – Szabolcs
    Aug 5, 2011 at 8:46
  • 7
    I don't recall any widespread dissatisfaction with LinearSolve. Using SparseArray s it can easily handle millions of equations. What precisely is your problem? Aug 5, 2011 at 11:46
  • It would not surprise me in the least, if Mathematica already links in some form of linear solver. Actually, it would surprise me if they didn't. Whether these are internal or external versions of LAPACK and BLAS, is irrelevant, as long as they're tested. Looking through the messages indicates that they're is already some LAPACK support. I have not used it, though.
    – rcollyer
    Aug 8, 2011 at 17:33
  • 1
    @rcollyer it is (very) briefly discussed in "The Internals of Mathematica". It also uses some version of ARPACK for sparse matrices (or in any case something that takes essentially the same options as ARPACK--these options are undocumented in v8, by the way, so one has to poke around to find them).
    – acl
    Aug 13, 2011 at 0:32

2 Answers 2

7

The short answer, I think, is that this is not something you really want to do.

GotoBLAS, as I understand it, is a specific implementation of BLAS, which stands for Basic Linear Algebra Subroutines. "Basic" really means quite basic here - multiply a matrix times a vector, for example. Thus, BLAS is not a solver that a function like LinearSolve would call. LinearSolve would (depending on the exact form of the arguments) call a LAPACK command, which is a higher level package built on top of BLAS. Thus, to really link GotoBLAS (or any BLAS) into Mathematica, one would really need to recompile the whole kernel.

Of course, one could write a C/Fortran program that was compiled against GotoBLAS and then link that into Mathematica. The resulting program would only use GotoBLAS when running whatever specific commands you've linked into Mathematica, however, which rather misses the whole point of BLAS.

0

The Wolfram Kernel (Mathematica) is already linked to the highly-optimized Intel Math Kernel Library, and is distributed with Mathematica. The MKL is multithreaded and vectorized, so I'm not sure what GotoBLAS would improve upon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.