forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dsygv not working as expected

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
rkr19



Joined: 21 Mar 2017
Posts: 2

PostPosted: Tue Mar 21, 2017 1:45 pm    Post subject: dsygv not working as expected Reply with quote

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
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Tue Mar 21, 2017 2:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
rkr19



Joined: 21 Mar 2017
Posts: 2

PostPosted: Thu Mar 23, 2017 1:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Fri Mar 24, 2017 1:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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