From: Dominique O. <dom...@gm...> - 2012-02-11 17:57:55
|
On Sat, Feb 11, 2012 at 04:30, Oz Nahum Tiram <na...@gm...> wrote: > Hi, > > First, thanks for the great work on this peace of software. I have > been using it for more than 3 years now and I very happy. > I have a few question and I hope this is not > I am still very new to C programming and I was wondering what does the > following statement for expamle do: > > n2b = F77(dnrm2)(&n, b, &ONE);/* Norm of rhs vector, b */ > > Is this some kind of type casting ? This is a macro that adjusts the call to various types of Fortran compilers (this particular call is a call to the BLAS library, which is written in Fortran). Some Fortran compilers add a trailing underscore to symbols, some add two, some add none, etc. > The second question is, now that I have a working application with > pysparse that I'd like to accelerate, > I am thinking of rewriting my code in C. I know there are C solvers > for bicgstab, but I was wondering how > much work is it just to convert the bicgstab.c from pysparse to plain > C without the python dependencies. > Are there any hints here? I wouldn't recommend coding bicgstab all over again. The only costly operations in Bi-CGSTAB (and other Krylov-type methods) are vector operations (most often, addition of vectors) and operator-vector products (e.g., A*x or A.T*x). I would say that to speed things up, you'll want to speed up your operator-vector operations; they are the dominant cost. You can take a look at PyKrylov (https://github.com/dpo/pykrylov) which contains a pure Python implementation of Bi-CGSTAB and allows you to input your operator in different ways (a Pysparse matrix being one of them). For instance, you could implement your operator in C or in Cython and that should speed things up. I believe that is the way to go. Of course, vector operations in PyKrylov could also be speeded up with Cython. That's been on my list for a while. I hope this helps. -- Dominique |