Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

MKL SPEVD documentation error and unknown error return--need help

nvaneck
New Contributor I
321 Views
I've got a call to spevd that works for a 2 dimensional matrix, but fails with a 15 dimensional matrix. The returned infoi value is -7, indicaiton error in 7th argument, but there are only 5 possible arguments to the F95 call. Additionally, the dicuemntation mentions a returned jobz argument that does not exist in the call. Even if it did, that would make only 7 arguemnts.

The call is:

use lapack95

REAL(8) R(MD,MD),E(MD),V(MD,MD),E1(MD),V1(MD,MD)
REAL(8) AP(MD*MD)
E1=0.
V1=0.
K=1
DO J=1,MD
DO I=J,MD
AP(K)=R(I,J)
K=K+1
END DO
END DO

CALL spevd(AP,E1,'L',V1,INFO)

where md is 21.

The documentaed call is:

Fortran 95:

call spevd(ap, w [,uplo] [,z] [,info])

and additionally states later:

Specific details for the routine spevd interface are the following:

ap Holds the array A of size (n*(n+1)/2).

w Holds the vector with the number of elements n.

z Holds the matrix Z of size (n, n).

uplo Must be 'U' or 'L'. The default value is 'U'.

jobz Restored based on the presence of the argument z as follows:

jobz = 'V', if z is present,

jobz = 'N', if z is omitted.

0 Kudos
7 Replies
mecej4
Honored Contributor III
321 Views
The documentation can be confusing since it tries to cover calling from F77, F9x and C. Likewise, runtime error messages can refer to the F77 call to which the F95 interface maps your call.

If you provide a complete, self-contained example that exhibits the problem, I can look at it. On the other hand, code fragments with unknown argument values are not enough to get started with probing for causes of aborts.
0 Kudos
Steven_L_Intel1
Employee
321 Views
I am moving this to the MKL forum section. I suggest posting MKL questions there for fastest response.
0 Kudos
nvaneck
New Contributor I
321 Views

OK, in building a complete example, I discoved that the AP argument must be passed with the exact dimension, i.e. AP(md*(md+1)/2) in my case. This is understandable, and I should have realized it sooner.

0 Kudos
mecej4
Honored Contributor III
321 Views
>must be passed with the exact dimension

That is an undesirable side effect of using the F95 interface. Since the argument list does not contain n, the number of rows (or columns) of the matrix, the value of n has to be deduced from the size of the packed array by solving a quadratic equation for n, ( n (n + 1) /2 = length of arrayAp) as we can see in the source files sspevd.f90and dspevd.f90.
The documentation says

The dimension ofapmust be at least max(1,n*(n+1)/2)

That does not apply to the F95 interface, for which "at least" should be removed. I hope that one of the Intel people will take note of this.
0 Kudos
Vladimir_Koldakov__I
New Contributor III
321 Views

Hi,

The info argument returns the number of argument of original Fortran 77 interface. So the argument -7 corresponds here to LDZ argument that is skipped in the Fortran 95 interface.

And really, at least does not apply to Fortran 95 arrays. All F95 arrays must have exact dimensions. MKL documentation claims:

Input arguments such as array dimensions are not required in Fortran95 and are skipped from the calling sequence. Array dimensions are reconstructed from the user data that must exactly follow the required array shape.

Thanks,

Vladimir

0 Kudos
Gennady_F_Intel
Moderator
321 Views
ok, thanks. we have got it.
0 Kudos
yuriisig
Beginner
321 Views

MKL *spevd there is a slow function. It is better to use algorithms of diagonalization for square matrixes. See http://software.intel.com/en-us/forums/showthread.php?t=76595&o=d&s=lr

0 Kudos
Reply