CLAPACK User Guide

134 views
Skip to first unread message

Ramesh

unread,
Sep 28, 2009, 2:22:00 PM9/28/09
to matrixpr...@googlegroups.com
Hello,

I am relatively new to CLAPACK and CBLAS. I was wondering if there is some help online for programmers. A quick reference would do. I am using AMD's ACML, which asks me to look up for help in netlib, which doesn't have sufficient documentation.

Also anyone have any idea on what is INCX and LDA in the BLAS and LAPACK routines. These fields doesn't make sense to me. Please help me with these questions.


Thanks,
Ramesh

Mark Hoemmen

unread,
Sep 28, 2009, 2:57:41 PM9/28/09
to matrixpr...@googlegroups.com
On Mon, Sep 28, 2009 at 11:22, Ramesh <ramesh1...@gmail.com> wrote:
> I am relatively new to CLAPACK and CBLAS. I was wondering if there is some
> help online for programmers. A quick reference would do. I am using AMD's
> ACML, which asks me to look up for help in netlib, which doesn't have
> sufficient documentation.

The ACML may be referring you to the LAPACK Users' Guide, which is
indeed available on the Netlib.

> Also anyone have any idea on what is INCX and LDA in the BLAS and LAPACK
> routines. These fields doesn't make sense to me. Please help me with these
> questions.

LDA = "leading dimension of A"
INCX = stride between elements of the vector X

mfh

Evgenii Rudnyi

unread,
Sep 28, 2009, 3:03:17 PM9/28/09
to matrixpr...@googlegroups.com
> I am relatively new to CLAPACK and CBLAS. I was wondering if there is some
> help online for programmers. A quick reference would do. I am using AMD's
> ACML, which asks me to look up for help in netlib, which doesn't have
> sufficient documentation.

A good starting point is the LAPACK Users Guide

http://www.netlib.org/lapack/lug/

Then just open the file with the Fortran subroutine, for example

http://www.netlib.org/lapack/double/dgesv.f

At the beginning there is pretty good description of the parameters.

> Also anyone have any idea on what is INCX and LDA in the BLAS and LAPACK
> routines. These fields doesn't make sense to me. Please help me with these
> questions.

LDA is so called the leading dimension. It comes from Fortran, well, you
have to learn a bit of Fortran to use BLAS and LAPACK. Yet, it is pretty
easy, Fortran 77 is very simple language (clearly you do not have to
understand FORMAT). A very good paper that should excite you to do it is

Real Programmers Don't Use Pascal
http://www.pbm.com/~lindahl/real.programmers.html

So, a two-dimensional array is stored as one dimensional array and it is
very important to understand that a Real Programmer stores the array by
columns. A Real Programmer also does not like dynamic memory allocation,
well, in Fortran there was no dynamic memory allocation anyway, so
actually it was no choice. A trick was to allocate more memory during
compile time and then to use part of it during run-time, for example

double precision a(1000,1000)

and then use only 10x10, or 20x20 or something like this. It was okay
until one needed to pass the array to the subroutine because it must
know the first real dimension and it was clearly not available in the
one dimensional array that was passed to the subroutine. So it was
necessary to pass the leading dimension, in the example above 1000. In
dgesv you will see then

DOUBLE PRECISION A( LDA, * ), B( LDB, * )

and then the subroutine is able to find necessary numbers in the arrays
correctly.

INCX, I guess, is the increment. What subroutine do you actually mean here?

Ramesh

unread,
Sep 28, 2009, 3:05:29 PM9/28/09
to matrixpr...@googlegroups.com
I leading dimension of A is max(M,N), which can be found inside the called function, whats the point in having that. 

INCX = stride between elements of the vector X
Can you explain me more about this? I dont understand what it really means. 

Thanks for your help.

mfh





--
Regards,
http://www.google.com/profiles/ramesh10dulkar

Ramesh

unread,
Sep 28, 2009, 3:14:22 PM9/28/09
to matrixpr...@googlegroups.com
Thanks, Evgenii. It was really helpful, I will be using double and float routines for A*x operations. 
For example you can take the following routine:
void dgemv(char transa, int m, int n, double alpha, double *a, int lda, double *x, int incx, double beta, double *y, int incy);
 
Thanks,
Ramesh
--
Regards,
http://www.google.com/profiles/ramesh10dulkar

Evgenii Rudnyi

unread,
Sep 28, 2009, 3:25:59 PM9/28/09
to matrixpr...@googlegroups.com
> Thanks, Evgenii. It was really helpful, I will be using double and float
> routines for A*x operations.
> For example you can take the following routine:
> void dgemv(char transa, int m, int n, double alpha, double *a, int lda,
> double *x, int incx, double beta, double *y, int incy);

The code is here

http://www.netlib.org/blas/dgemv.f

The description of incx suggest that you may use not every entry in x
but rather each second, each third and so on. They have tried to develop
an interface as general as possible. If you look at the code, then you
can see that incx could be also negative. In this case they seem to use
the values from the end.

Ramesh

unread,
Sep 28, 2009, 3:34:00 PM9/28/09
to matrixpr...@googlegroups.com
Thanks a lot. I assume using every second entry or so forth, may be useful in some cases. I won't need that anyway.
--
Regards,
http://www.google.com/profiles/ramesh10dulkar
Reply all
Reply to author
Forward
0 new messages