
forums.silverfrost.com Welcome to the Silverfrost forums

View previous topic :: View next topic 
Author 
Message 
rkr19
Joined: 21 Mar 2017 Posts: 2

Posted: Tue Mar 21, 2017 1:45 pm Post subject: dsygv not working as expected 


I am using fortran on windows machine. My program generates two matrices A and B – both square, symmetric and positive definite. These matrices were generated based on a problem input from my side into the fortran program. I tried 6 independent runs with slight variation in inputs – for 5 cases, it ran well, the eigen values were matching my independent calcs using a software and also with Mathcad. For the 6th case, the dsygv listing gives 2 negative numbers as eigen values which was not expected. I took these matrices in Mathcad, and I got the answers matching software calculations. So this means, the matrices A and B are ok. could you please assist me to find why they are not working with dsygv. While comparing the dsygv listing with Mathcad, I found that eigen value(3) in dsygv was matching eigenval(1) of mathcad, eigenval(4) was matching eigenval(2) of mathcad and so on.. looks like the 2 negative values got inserted in the listing  could some one explain why this is happening. the A and B matrices are generated inside fortran and solved using dsygv. In the 6th case, there is some discrepancy(only while using dsygv, it works as usual while using mathcad/or independent software)  any guidance is appreciated.
link to matrices
https://www.dropbox.com/s/djji2bq8lzi8h7d/A%20and%20B%20_matx.zip?dl=0
comparison of mathcad results with fortran for the above matrices
https://www.dropbox.com/s/eynvb2clpk46gkn/comparison.JPG?dl=0 

Back to top 


mecej4
Joined: 31 Oct 2006 Posts: 1092

Posted: Tue Mar 21, 2017 2:12 pm Post subject: 


If there is a connection to FTN95, I have not seen it. If there are questions regarding whether you have used Lapack correctly, those can be addressed only if you show the code.
You say that the matrix is positive definite. How do you know that?
One of your matrices has over 600 rows. If it is square, the matrix has 360,000 elements, most of which are zero. If you present the data in one of the standard formats in a text file, I'll look at it. For example, use the COO format, with one triplet (Row, Column, Value) for each entry. To expect a human to peer at 360,000 boxes in an Excel spreadsheet is not reasonable. 

Back to top 


rkr19
Joined: 21 Mar 2017 Posts: 2

Posted: Thu Mar 23, 2017 1:27 pm Post subject: 


you are right, they are 2d array with 670 x 670 size, how do i save it in coo format  never used this, i was printing them out of fortran in excel format. please let me know how to save/print it in the coo format 

Back to top 


mecej4
Joined: 31 Oct 2006 Posts: 1092

Posted: Fri Mar 24, 2017 1:16 pm Post subject: 


Here a sketch of the code to do that:
Code:  integer, parameter :: MMAX = 670, NMAX = 670
double precision A(MMAX,NMAX)
integer i,j
!
! open unit 11 for output COO file
open(11,file='coo.txt',status='replace')
do j=1,NMAX
do i=1,MMAX
if (A(i,j) /= 0.0) write(11,'(2i6,2x,ES15.7)')i,j,A(i,j)
end do
end do
close(11)



Back to top 




You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
