Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Use of ARPACK
Posted:
Dec 8, 2011 9:55 AM
|
|
Dieter Britz <dieterhansbritz@gmail.com> writes: >Alois Steindl wrote: > >> Hello, >> Dieter Britz <dieterhansbritz@gmail.com> writes: >> >>> Are there any simple examples for what I want to do, i.e. use ARPACK >>> on a sparse matrix that I preduce myself? >> It seems impossible to guess from your description, what you really want >> to do. In order to use ARPACK, you will have to provide the matrix >> elements in the required form. >> How do you produce your matrix? >> >> Alois >> > >It will be in the form of three arrays, for row and column indices >and values. I see no provision for such data structures in the examples >in the ARPACK examples. They seem to assume fixed matrices, whose >values etc are generated within the routines. I was hoping for an example >showing how to handle a sparse matrix in the form I mention. > >Or are there other programs to do this job? > >The frustrating thing is that a theoretical chemist I know reckons >that what with my "small" matrices (up to a few hundreds x a few hundreds), >it probably will not pay me to use ARPACK instead of a routine like >RGG, which is for non-sparse matrices, because of the overhead for >ARPACK. . However, I want to make sure this is correct. >-- >Dieter Britz (dieterhansbritz<at>gmail.com)
well this is in fortran : you have the notation (i1(i),i2(i),val(i)) i=1,nz denoting the elements A(i1(i),i2(i)) of your matrix which are nonzero. you also have a vector v(1:n) and need the result w=A*v:
do i=1,n w(i)=0.d0 enddo do i=1,nz w(i1(i)) = w(i1(i))+val(i)*v(i2(i)) enddo
that should do it hth peter
|
|
|
|