Solving the Fortran LAPACK DSYEV Error with a 3x3 Matrix

In summary, there are two required input parameters (jobz and uplo), three required input/output parameters (n, a, and w), two optional input parameters (work and lwork), and one optional output parameter (info). Make sure you are passing the correct values for each of these parameters.
  • #1
tarekph
1
0
Hello
I am a beginner in programming with Fortran and I want to use the LAPACK DSYEV in my program.
I am an example to determine the eigenvalues ​​of a matrix (3x3) after I use it in my program but when I compile I get this error
"" "" "** One entry to DSYEV parameter number 5 Had an illegal value" "" ""
Here is my example:
Program eigenvalue

implicit none

! statements
double precision :: A (3.3), w (3), Work (3)
integer :: i INFO, LWORK, LDA = 3
character :: N, U

! A matrix
A (1 : ) = (/ 3, 1, 3 /)
A (2, : ) = (/ 1, 5, 6 /)
A (3 : ) = (/ 3, 6, 5 /)




CALL DSYEV ('N', 'U', 3, Q, W, LDA, WORK, LWORK, INFO)

! print the solution
do i = 1, 3
write (*, 9) i, w (i)
end do

9 format ('x [' i1 '] =', f5.2)
end programs eigenvalue
I know not how I met the LDA or WORK .. LWORK...
thank you
 
Technology news on Phys.org
  • #2


tarekph said:
Hello
I am a beginner in programming with Fortran and I want to use the LAPACK DSYEV in my program.
I am an example to determine the eigenvalues ​​of a matrix (3x3) after I use it in my program but when I compile I get this error
"" "" "** One entry to DSYEV parameter number 5 Had an illegal value" "" ""
Here is my example:
Program eigenvalue

implicit none

! statements
double precision :: A (3.3), w (3), Work (3)
integer :: i INFO, LWORK, LDA = 3
character :: N, U

! A matrix
A (1 : ) = (/ 3, 1, 3 /)
A (2, : ) = (/ 1, 5, 6 /)
A (3 : ) = (/ 3, 6, 5 /)




CALL DSYEV ('N', 'U', 3, Q, W, LDA, WORK, LWORK, INFO)

! print the solution
do i = 1, 3
write (*, 9) i, w (i)
end do

9 format ('x [' i1 '] =', f5.2)
end programs eigenvalue
I know not how I met the LDA or WORK .. LWORK...
thank you

I see a couple of mistakes in your code.
1) In this line -- double precision :: A (3.3) -- there should be a comma between the two 3s, not a period.
2) You passed Q in the call to DSYEV. That's the parameter that should be the array A.

I found a link to some documentation on DSYEV - it explains what the parameters need to be - http://www.netlib.org/lapack/double/dsyev.f
 
  • Like
Likes GadhaR

What is Fortran LAPACK DSYEV Error?

Fortran LAPACK DSYEV Error is an error that occurs when trying to solve a 3x3 matrix using the DSYEV function in the LAPACK library. This error is typically caused by issues with the input matrix or incorrect parameters being passed to the function.

Why am I getting this error when solving a 3x3 matrix?

You may be getting this error because there is an issue with your input matrix. The DSYEV function requires a specific format for the input matrix, and any deviations from this format can cause the error. Make sure your matrix is properly formatted and all parameters are correctly specified.

How can I solve the Fortran LAPACK DSYEV Error?

To solve this error, you will need to carefully review your code and make sure all inputs are correct. Check the format of your input matrix and ensure all parameters are properly specified. You may also need to consult the documentation for the DSYEV function to ensure you are using it correctly.

Are there any common mistakes that can cause this error?

Yes, some common mistakes that can cause the Fortran LAPACK DSYEV Error include incorrect input matrix format, incorrect parameter values, and not using the function in the correct order. It is important to double-check your code and make sure all inputs are correct.

Is there a way to prevent this error from occurring?

Yes, there are a few ways to prevent this error from occurring. First, make sure you are using the DSYEV function correctly and all inputs are in the correct format. Additionally, you can use debugging tools to catch any errors before running your code. It is also helpful to thoroughly test your code before using it on larger datasets.

Similar threads

  • Programming and Computer Science
Replies
4
Views
6K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
18
Views
6K
  • Programming and Computer Science
Replies
22
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
7
Views
4K
  • Programming and Computer Science
Replies
4
Views
588
  • Programming and Computer Science
Replies
8
Views
2K
Back
Top