mirror of
https://github.com/pfloos/quack
synced 2024-10-31 19:23:52 +01:00
optimize memory in diagonalizations
This commit is contained in:
parent
a1b4abf10a
commit
c797967170
@ -19,8 +19,15 @@ subroutine diagonalize_general_matrix(N,A,WR,VR)
|
|||||||
|
|
||||||
! Memory allocation
|
! Memory allocation
|
||||||
|
|
||||||
lwork = 4*N
|
allocate(work(1),WI(N),VL(N,N))
|
||||||
allocate(WI(N),VL(N,N),work(lwork))
|
|
||||||
|
lwork = -1
|
||||||
|
call dgeev('V','V',N,A,N,WR,WI,VL,N,VR,N,work,lwork,info)
|
||||||
|
lwork = int(work(1))
|
||||||
|
|
||||||
|
deallocate(work)
|
||||||
|
|
||||||
|
allocate(work(lwork))
|
||||||
|
|
||||||
call dgeev('V','V',N,A,N,WR,WI,VL,N,VR,N,work,lwork,info)
|
call dgeev('V','V',N,A,N,WR,WI,VL,N,VR,N,work,lwork,info)
|
||||||
|
|
||||||
@ -49,8 +56,15 @@ subroutine diagonalize_matrix(N,A,e)
|
|||||||
|
|
||||||
! Memory allocation
|
! Memory allocation
|
||||||
|
|
||||||
allocate(work(3*N))
|
allocate(work(1))
|
||||||
lwork = size(work)
|
|
||||||
|
lwork = -1
|
||||||
|
call dsyev('V','U',N,A,N,e,work,lwork,info)
|
||||||
|
lwork = int(work(1))
|
||||||
|
|
||||||
|
deallocate(work)
|
||||||
|
|
||||||
|
allocate(work(lwork))
|
||||||
|
|
||||||
call dsyev('V','U',N,A,N,e,work,lwork,info)
|
call dsyev('V','U',N,A,N,e,work,lwork,info)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user