# Fortran90: Subroutine DSYEV and associating eigenvalues and eigenvectors.

• Fortran
• Animastryfe
In summary, the conversation discusses using the LAPACK software package to find the eigenvalues and eigenvectors of a large symmetrical real matrix. The subroutine DSYEV is used, which outputs the eigenvalues in ascending order. The question is whether there is a way to associate each eigenvector with its eigenvalue. The response clarifies that the eigenvectors are returned in the A matrix in the same order as the eigenvalues, with A(1:N, 1) being the vector for W(1), A(1:N, 2) for W(2), and so on. Additionally, setting JOBV = "V" will return the eigenvectors in the columns of the matrix A.
Animastryfe
Greetings. I am using the LAPACK (Linear Algebra Package) software package to find the eigenvalues and eigenvectors of a large symmetrical real matrix. Specifically, I calculate a scalar from each eigenvector, and I want to graph it against its associated eigenvalue.

I am using the subroutine DSYEV of LAPACK to do this. However, DSYEV outputs the eigenvalues in ascending order, and I'm not sure how it orders the eigenvectors. Is there a way to associate each eigenvector with its eigenvalue?

Edit: The official page for DSYEV is here: http://www.netlib.org/lapack/double/dsyev.f
Here is another page about it: http://www.nag.co.uk/numeric/fl/nagdoc_fl22/xhtml/F08/f08faf.xml

The eigenvectors are returned in the A matrix in the same order as the eigenvalues.

A(1:N, 1) is the vector for W(1), A(1:N, 2) is the vector for W(2), etc.

Thank you very much for the reply.

Just to be completely clear: the columns of the matrix A are the eigenvectors?

If you set JOBV = "V", then yes. Otherwise, no!

Hello, thank you for reaching out. I understand your concern about associating eigenvalues and eigenvectors using the DSYEV subroutine in Fortran90. After reviewing the documentation for DSYEV, it seems that the subroutine does not explicitly associate the eigenvalues and eigenvectors in its output. However, there are a few ways you can approach this problem.

One option is to use the output eigenvalues in ascending order as a reference for the eigenvectors. Since the eigenvectors are returned in the same order as the eigenvalues, you can use the index of each eigenvalue to associate it with its corresponding eigenvector.

Another option is to use the LAPACK subroutine DSYEVR, which allows you to specify the range of eigenvalues you are interested in. This subroutine also returns the eigenvalues and eigenvectors in the same order, making it easier to associate them.

Additionally, you can use the LAPACK subroutine DSYEVX, which allows you to specify the desired eigenvalues or a range of eigenvalues and returns the associated eigenvectors.

I hope this helps. As always, I recommend consulting the official documentation and possibly reaching out to the developers of LAPACK for further clarification or assistance. Best of luck with your research.

## 1. What is a subroutine in Fortran90?

A subroutine in Fortran90 is a section of code that performs a specific task within a larger program. It is similar to a function, but it does not return a value. Subroutines are commonly used for organizing and reusing code, making programs more efficient and easier to read.

## 2. What is the DSYEV subroutine in Fortran90?

The DSYEV subroutine in Fortran90 is a built-in function that calculates the eigenvalues and eigenvectors of a symmetric matrix. It is part of the LAPACK library, which is a collection of numerical algorithms for linear algebra.

## 3. How do I use the DSYEV subroutine in my program?

To use the DSYEV subroutine in your program, you must first include the LAPACK library by adding the statement "USE LAPACK" at the beginning of your code. Then, you can call the subroutine by providing the necessary arguments, such as the matrix to be analyzed, the size of the matrix, and the arrays to store the eigenvalues and eigenvectors.

## 4. What is the significance of eigenvalues and eigenvectors?

Eigenvalues and eigenvectors are important concepts in linear algebra and have various applications in science and engineering. Eigenvalues represent the scaling factor of the eigenvectors, which are special vectors that do not change direction when multiplied by a matrix. They are used to solve systems of linear equations, perform data analysis, and in the study of vibrations and quantum mechanics.

## 5. Can the DSYEV subroutine handle non-symmetric matrices?

No, the DSYEV subroutine is specifically designed for symmetric matrices. However, there are other subroutines in the LAPACK library that can handle non-symmetric matrices, such as DGEEV and DGEES.

• Programming and Computer Science
Replies
4
Views
1K
• Programming and Computer Science
Replies
18
Views
6K
Replies
2
Views
4K
• Calculus and Beyond Homework Help
Replies
1
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
7K
• Calculus and Beyond Homework Help
Replies
3
Views
4K
• Programming and Computer Science
Replies
8
Views
2K
Replies
10
Views
4K
• Special and General Relativity
Replies
13
Views
2K
• General Discussion
Replies
109
Views
54K