Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ARPACK: Need help to run simple programs 1

Status
Not open for further replies.

vfvieira

Programmer
Oct 22, 2009
3
BR
Hi,
I have installed ARPACK for the calculation of eigenvalues but I couldn't do much things, so I need some help.
The installation was made successfully and I could customize and run the sample examples that came with the package.
My problem is to run simple examples with my own matrixes. I don't know how to load a matrix (from a file, for example) and get the eigenvalues. This matrix could be any real matrix (sparse or dense, symmetric or not).
If anyone could help I will be so grateful.
Thanks,
Vinicius Vieira
 
I don't know how to load a matrix (from a file, for example)
There were several threads in this forum which contain source code how to read data from a text file into an array.
You can use that code for starting to write your own program.
 
No... I think I was misunderstood... My problem is in passing the loaded matrix to ARPACK.
ARPACK examples use some calculated matrixes, but I need to pass my own matrix.
Sorry for the badly formulated question.
Thanks,
Vinicius Vieira
 
Here is the ARPACK userguide in HTML
and here in PDF

As I could remember, the eigenvalues (lambda) should fulfill this condition:
Code:
A*x = lambda*x
where A is a Matrix, x is a vector.
The vector which fulfill the above condition is called eigenvector.

As I looked in the above documentation, I understood it so, that in ARPACK the input matrix is never given explicitly, but instead you should program your own subroutine which realizes the matrix-vector multiplication
Code:
y = A*x
In this introductory example
this subroutine's name is matvec and it takes as input the vector x=workd(ipntr(1)) and computes the output vector y=workd(ipntr(2)) as matrix-vector product. It means, that the Matrix is coded inside of the subroutine. It's on you, how you get the matrix: for example you can program your subroutine matvec so, that you take the matrix from an temporary array, then multiply it with an input vector and store the result in an outputvector. Hovever before the iteraion loop, you can read the matrix form a file into the temporary array.
As you see from the example given in the user guide, your multiplication subroutine need to be called in every iteration and the vector workd which contains the input and output of the multiplication subroutine matvec will be then passed as an argument to the ARPACK's subroutine snaupd.

For further details you should look into documentation and in the example programs delivered in package.
 
Thanks for the reply. I had already read the user guide but I was getting serious difficulties to understand the Reverse Communication concept.

I'm used to code with math libraries but ARPACK was dark for me.
Your explanation made things clearer. Now I see there's no need to pass my matrix to ARPACK routines. The matrix manipulation is all under my responsability.

Thanks a lot for the explanation.
 
Hi vfvieira,

I never used ARPACK before. But the concept of it is interesting.
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top