- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just want to diagonalize this matrix (2, 1+i \\ -1+i, -2 ) for my test. Then a error occurs:
"Intel MKL ERROR: Parameter 12 was incorrect on entry to CGEEV".
I need some help for my programming, here's my procedure, maybe something wrong in it. I got my procedure by copying the CGEEV example in "Intel® oneAPI Math Kernel Library
LAPACK Examples”, which appears in page 431-433.
program main
use lapack95
!use blas95
!implicit real(kind=8)(a-h,o-z)
INTEGER INFO,LWORK,N
PARAMETER (LWMAX=1000)
PARAMETER ( N=2 )
PARAMETER ( LDA=N, LDVL=N, LDVR=N )
complex(kind=8) rk(N,N), A(N,N)
complex(kind=8) W(N), VL(LDVL,N), VR(LDVR,N), WORK(LWMAX)
real(kind=8) RWORK(2*N)
EXTERNAL CGEEV
rk(1,1)=2.d0
rk(2,2)=-2.d0
rk(1,2)=CMPLX(1.d0,1.d0)
rk(2,1)=-CMPLX(1.d0,-1.d0)
!=====================================================================
A=rk
write(*,*)"A="
write(*,*)A
LWORK=-1
CALL CGEEV( 'V', 'V', N, A, LDA, W, VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
LWORK = MIN( LWMAX, INT( WORK(1) ) )
call cgeev('V', 'V', N, A, LDA, W, VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
!======================================================================
write(*,*)
write(*,*)"The eigenvalues and some OUTPUT infomations"
write(*,*)w,info,LWMAX,WORk(1),INT( WORK(1) )
pause
stop
end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear YiqunLiu
Here is a slightly modified version (i) due to problems between real(4) vs real(8) in the use of cmplx ; (ii) and to also compile alternatively with gfortran+atlas:
program main
!use lapack95
!use blas95
!implicit real (kind=8)(a-h,o-z)
implicit none
integer :: info, lwork, n
integer :: lwmax, lda, ldvl, ldvr
parameter (lwmax=1000)
parameter (n=2)
parameter (lda=n, ldvl=n, ldvr=n)
complex (kind=8) :: rk (n,n), aa (n,n)
complex (kind=8) :: ww (n), vl (ldvl,n), vr (ldvr,n), work (lwmax)
real (kind=8) :: rwork (2*n)
external zgeev
!
rk(1,1)= 2.0d0
rk(2,2)=-2.0d0
rk(1,2)= cmplx (1.0d0, 1.0d0,kind=8)
rk(2,1)=-cmplx (1.0d0,-1.0d0,kind=8)
!
aa=rk
lwork=-1
!
write (*,*)"aa="
write (*,*) aa
call zgeev ('v','v',n,aa,lda,ww,vl,ldvl,vr,ldvr,work,lwork,rwork,info)
lwork = min (lwmax, int (work(1)))
call zgeev ('v','v',n,aa,lda,ww,vl,ldvl,vr,ldvr,work,lwork,rwork,info)
!
write (*,*)"the eigenvalues and some output infomations"
write (*,*) ww, info, lwmax, work(1), int(work(1))
!
end program main
Then, (i) with ifort
$ ifort --version
ifort (IFORT) 2021.9.0 20230302
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
ifort -O2 -o test182-i.exe -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -ldl test182.f90
$ test182-i.exe
aa=
(2.00000000000000,0.000000000000000E+000) (-1.00000000000000,1.00000000000000)
(1.00000000000000,1.00000000000000) (-2.00000000000000,0.000000000000000E+000)
the eigenvalues and some output infomations
(1.41421356237309,1.110223024625158E-016)
(-1.41421356237309,-1.110223024625157E-016) 0 1000
(66.0000000000000,0.000000000000000E+000) 66
and (ii) with ifx:
ifx --version
ifx (IFX) 2023.1.0 20230320
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
$ ifx -O2 -o test182-ifx.exe -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -ldl test182.f90
[jdelia@amaral SHORT]$ test182-ifx.exe
aa=
(2.00000000000000,0.000000000000000E+000) (-1.00000000000000,1.00000000000000)
(1.00000000000000,1.00000000000000) (-2.00000000000000,0.000000000000000E+000)
the eigenvalues and some output infomations
(1.41421356237309,1.110223024625158E-016)
(-1.41421356237309,-1.110223024625157E-016) 0 1000
(66.0000000000000,0.000000000000000E+000) 66
Regards.
JorgeD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program main
!use lapack95
!use blas95
!implicit real (kind=8)(a-h,o-z)
implicit none
integer :: info, lwork, n
integer :: lwmax, lda, ldvl, ldvr
parameter (lwmax=1000)
parameter (n=2)
parameter (lda=n, ldvl=n, ldvr=n)
complex (kind=8) :: rk (n,n), aa (n,n)
complex (kind=8) :: ww (n), vl (ldvl,n), vr (ldvr,n), work (lwmax)
real (kind=8) :: rwork (2*n)
external zgeev
!
rk(1,1)= 2.0d0
rk(2,2)=-2.0d0
rk(1,2)= cmplx (1.0d0, 1.0d0,kind=8)
rk(2,1)=-cmplx (1.0d0,-1.0d0,kind=8)
!
aa=rk
lwork=-1
!
write (*,*)"aa="
write (*,*) aa
call zgeev ('v','v',n,aa,lda,ww,vl,ldvl,vr,ldvr,work,lwork,rwork,info)
lwork = min (lwmax, int (work(1)))
call zgeev ('v','v',n,aa,lda,ww,vl,ldvl,vr,ldvr,work,lwork,rwork,info)
!
write (*,*)"the eigenvalues and some output infomations"
write (*,*) ww, info, lwmax, work(1), int(work(1))
!
end program main
A really great human bean, added the facility to this website to nicely format the Fortran code. No idea who that human bean was or is or has been, but it helps us mere human mortals of finite life duration read the code.
Can I say that you could clean up the parameter declarations into one line instead of multiple lines. It would be easier to read.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear JohnNichols,
You're right but, where can I find info about how to use that facility to nicely format Fortran code?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ask John to tell you about TIDY.
Doc (not an Intel employee or contractor)
[Maybe Windows 12 will be better]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the reply box there are three buttons at the end of the format bar, this button opens a second row and the icon </> lets you input formatted Fortran text. Select the text type as Fortran and we can then look at it.
pretty standard practice on this site is not to use kind = 8, but the other kind of way of doing it.
!---------------------------------------------------------------------------------------------------------------------------
!
! Four modules are called from the main program.
! Base holds the underlying FORTRAN elements such as dp etc.
! Subroutines
! OpenFiles (i,j,k,l,m)
! LineBlank(sw)
! Line(sw)
! Timingline(sw)
!
!---------------------------------------------------------------------------------------------------------------------------
Module Base
!INTEGER, PARAMETER :: dp = selected_real_kind(30)
INTEGER, PARAMETER :: dp = selected_real_kind(15, 307)
INTEGER, PARAMETER :: dpA = selected_real_kind(15, 307)
INTEGER, PARAMETER :: sw = 2 ! Output file
INTEGER, PARAMETER :: srA = 15 ! output.txt file
INTEGER, PARAMETER :: st = 14
INTEGER, PARAMETER :: sa = 3 ! Output file
INTEGER, PARAMETER :: smWrite = 4
INTEGER, PARAMETER :: si = 1
Integer, parameter :: slog = 9 ! Log file
Integer, parameter :: nta = 100 ! Log file
Integer, parameter :: outNode = 63 ! Log file
Integer, parameter :: inNode = 0 ! Log file
Integer, parameter :: NUM = 50 ! Column Steps for Warner equations
REAL (KIND=dp), PARAMETER :: gr = 9.806, pi = 3.14159265D0 ! Standard parameters
REAL (KIND=dp), PARAMETER :: delta = 0.0001 ! Error number of checking for zero
REAL (KIND=dp), PARAMETER :: deltaS = 0.1 ! Error number of checking for zero
Of course there are variations and the Four Titans of this site will tell you the mistakes they see in my method. One just has to accept that one is a failure in life and it then is easy to not get upset. As the father of four daughters I accept constant failure.
Dr. Hill has made some reference to TIDY. At the moment, my brain is deep inside Dutch bridges and the reference illudes me, but it may reference some obscure program that does absolutely nothing with blinding speed and Jim will tell you how to make it faster. If a program can run in less time than it takes to make a cup of tea then you are a failure, tea time is important. MS 3.31 Fortran and the unnamed computer were perfect for that, a DELL Precision and ONEAPI is a complete failure at making time for tea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if you are a https://www.peanuts.com/about/linus this site is not for you, try Fortran discourse.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear JohnNichols,
- Ok, thanks a lot for summarizing how to nicely format a fortran code in this site. Maybe it could be included in the FAQ.
- Yes, I know that it is not recommended to use kind=8, and that there are another ways to do it.
- I suspect that TIDY is intended for windows users. While I am OS neutral, I usually use Linux (Fedora).
Thank you very much for the tips.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page