[問題] 想找出eigenvalue所對應的eigenfuction

看板Fortran作者 (我是男人 ￾N )時間14年前 (2010/04/17 21:22), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我計算了一個龐大矩陣的eigenvalue,eigenfuction後,又寫了一個泡泡排序法的副程式 想將eigenvalue從低到高排列出來,也排序成功了,但是遇到了一個問題,我不知道怎 去取得從低到高排列出來的eigenvalue對應的eigenfuction 請問各位前被該怎麼辦才好 以下程式碼 !!This is a quantum and It's H operator use imsl implicit NONE REAL*8,external::f INTEGER NN,LDEVEC,LDA,NOUT,test REAL*8 H,EVAL,EVEC,C,KM,KN,PI,MASS,L,HBAR REAL*8 A,B,ERRABS,ERRREL,ERR REAL*8 ANS,m,n PARAMETER(NN=10,LDEVEC=NN,LDA=NN) !CHANGE THE SIZE OF HAMILTONIAN parameter(ERRABS=1D-5,ERRREL=1D-5) DIMENSION H(NN,NN),EVAL(NN),EVEC(LDEVEC),C(LDA,NN) COMMON /QUANTUMNUMBER/ n,m CALL UMACH(2,NOUT) a=-20. !lower b=20. !upper do N=1,10 !change the size of hamiltonian do M=1,10 !change the size of hamiltonian call DQDAGS(f,a,b,errabs,errrel,ans,err) !open(11,file='hamiltonian.TXT') !WRITE(*,*) ANS H(M,N)=ANS enddo enddo !WRITE(*,*) h(2,1) CALL DEVCSF (NN, H, LDA, EVAL, EVEC, LDEVEC) !WRITE(*,*) "EVAL","=",eval,"evec","=",evec call arrangement(eval,nn) !open(20,file='eval.txt') write(*,*) "EVAL","=",eval end real function f(x) implicit none real*8 m,n REAL*8 KM,KN,PI,MASS,L,HBAR,V,x COMMON /QUANTUMNUMBER/ n,m !!!!!!! L=length=40 PI=DACOS(-1.d0) MASS=1. L=40. !change the length hbar=1. V=0. KM=M*PI/L KN=N*PI/L f=(((hbar**2)*km*kn/(MASS*2.))*Dcos(km*(x+L/2.))*DCOS(KN*(X+L/2.)))+ (DSIN(KM*(X+L/2.))*DSIN(KN*(X+L/2.))*v) return end function !!!!bubble sort!!!!!!!! subroutine arrangement(eval1,nnn) implicit none integer nnn,i,j real*8 temp,eval1 dimension eval1(nnn) do i=nnn-1,1,-1 do j=1,i if(eval1(j)>eval1(j+1))then temp=eval1(j) eval1(j)=eval1(j+1) eval1(j+1)=temp endif enddo enddo return end subroutine -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.36.204.78

04/18 16:24, , 1F
另外建立一組紀錄為編號,跟著bubble一起排序
04/18 16:24, 1F
文章代碼(AID): #1BoROpKg (Fortran)
文章代碼(AID): #1BoROpKg (Fortran)