Developer Reference

Contents

p?hegvx

Computes selected eigenvalues and, optionally, eigenvectors of a complex generalized Hermitian positive-definite eigenproblem.

Syntax

void
pchegvx
(
MKL_INT
*ibtype
,
char
*jobz
,
char
*range
,
char
*uplo
,
MKL_INT
*n
,
MKL_Complex8
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
MKL_Complex8
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
float
*vl
,
float
*vu
,
MKL_INT
*il
,
MKL_INT
*iu
,
float
*abstol
,
MKL_INT
*m
,
MKL_INT
*nz
,
float
*w
,
float
*orfac
,
MKL_Complex8
*z
,
MKL_INT
*iz
,
MKL_INT
*jz
,
MKL_INT
*descz
,
MKL_Complex8
*work
,
MKL_INT
*lwork
,
float
*rwork
,
MKL_INT
*lrwork
,
MKL_INT
*iwork
,
MKL_INT
*liwork
,
MKL_INT
*ifail
,
MKL_INT
*iclustr
,
float
*gap
,
MKL_INT
*info
);
void
pzhegvx
(
MKL_INT
*ibtype
,
char
*jobz
,
char
*range
,
char
*uplo
,
MKL_INT
*n
,
MKL_Complex16
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
MKL_Complex16
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
double
*vl
,
double
*vu
,
MKL_INT
*il
,
MKL_INT
*iu
,
double
*abstol
,
MKL_INT
*m
,
MKL_INT
*nz
,
double
*w
,
double
*orfac
,
MKL_Complex16
*z
,
MKL_INT
*iz
,
MKL_INT
*jz
,
MKL_INT
*descz
,
MKL_Complex16
*work
,
MKL_INT
*lwork
,
double
*rwork
,
MKL_INT
*lrwork
,
MKL_INT
*iwork
,
MKL_INT
*liwork
,
MKL_INT
*ifail
,
MKL_INT
*iclustr
,
double
*gap
,
MKL_INT
*info
);
Include Files
  • mkl_scalapack.h
Description
The
p?hegvx
function
computes all the eigenvalues, and optionally, the eigenvectors of a complex generalized Hermitian positive-definite eigenproblem, of the form
sub(
A
)*
x
=
λ*
sub(
B
)*
x
, sub(
A
)*sub(
B
)*
x
=
λ*
x
, or sub(
B
)*sub(
A
)*
x
=
λ*
x
.
Here sub (
A
) denoting
A
(
ia
:
ia
+
n
-1,
ja
:
ja
+
n
-1)
and sub(
B
) are assumed to be Hermitian and sub(
B
) denoting
B
(
ib
:
ib
+
n
-1,
jb
:
jb
+
n
-1)
is also positive definite.
Optimization Notice
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804
This notice covers the following instruction sets: SSE2, SSE4.2, AVX2, AVX-512.
Input Parameters
ibtype
(global) Must be 1 or 2 or 3.
Specifies the problem type to be solved:
If
ibtype
= 1
, the problem type is
sub(
A
)*
x
=
lambda
*sub(
B
)*
x
;
If
ibtype
= 2
, the problem type is
sub(
A
)*sub(
B
)*
x
=
lambda
*
x
;
If
ibtype
= 3
, the problem type is
sub(
B
)*sub(
A
)*
x
=
lambda
*
x
.
jobz
(global) Must be
'N'
or
'V'
.
If
jobz
=
'N'
, then compute eigenvalues only.
If
jobz
=
'V'
, then compute eigenvalues and eigenvectors.
range
(global) Must be
'A'
or
'V'
or
'I'
.
If
range
=
'A'
, the
function
computes all eigenvalues.
If
range
=
'V'
, the
function
computes eigenvalues in the interval:
[
vl
,
vu
]
If
range
=
'I'
, the
function
computes eigenvalues with indices
il
through
iu
.
uplo
(global) Must be
'U'
or
'L'
.
If
uplo
=
'U'
, arrays
a
and
b
store the upper triangles of sub(
A
) and sub (
B
);
If
uplo
=
'L'
, arrays
a
and
b
store the lower triangles of sub(
A
) and sub (
B
).
n
(global)
The order of the matrices sub(
A
) and sub (
B
)
(
n
0)
.
a
(local)
Pointer into the local memory to an array of size
lld_a
*
LOCc
(
ja
+
n
-1)
. On entry, this array contains the local pieces of the
n
-by-
n
Hermitian distributed matrix sub(
A
). If
uplo
=
'U'
, the leading
n
-by-
n
upper triangular part of sub(
A
) contains the upper triangular part of the matrix. If
uplo
=
'L'
, the leading
n
-by-
n
lower triangular part of sub(
A
) contains the lower triangular part of the matrix.
ia
,
ja
(global)
The row and column indices in the global matrix
A
indicating the first row and the first column of the submatrix
A
, respectively.
desca
(global and local) array of size
dlen_
.
The array descriptor for the distributed matrix
A
. If
desca
[
ctxt_
- 1]
is incorrect, p?hegvx cannot guarantee correct error reporting.
b
(local).
Pointer into the local memory to an array of size
lld_b
*
LOCc
(
jb
+
n
-1)
. On entry, this array contains the local pieces of the
n
-by-
n
Hermitian distributed matrix sub(
B
).
If
uplo
=
'U'
, the leading
n
-by-
n
upper triangular part of sub(
B
) contains the upper triangular part of the matrix.
If
uplo
=
'L'
, the leading
n
-by-
n
lower triangular part of sub(
B
) contains the lower triangular part of the matrix.
ib
,
jb
(global)
The row and column indices in the global matrix
B
indicating the first row and the first column of the submatrix
B
, respectively.
descb
(global and local) array of size
dlen_
.
The array descriptor for the distributed matrix
B.
descb
[
ctxt_
- 1]
must be equal to
desca
[
ctxt_
- 1]
.
vl
,
vu
(global)
If
range
=
'V'
, the lower and upper bounds of the interval to be searched for eigenvalues.
If
range
=
'A'
or
'I'
,
vl
and
vu
are not referenced.
il
,
iu
(global)
If
range
=
'I'
, the indices in ascending order of the smallest and largest eigenvalues to be returned. Constraint:
il
1, min(
il
,
n
) ≤
iu
n
If
range
=
'A'
or
'V'
,
il
and
iu
are not referenced.
abstol
(global)
If
jobz
=
'V'
, setting
abstol
to
p?lamch
(
context
,
'U'
)
yields the most orthogonal eigenvectors.
The absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval
[
a
,
b
]
of width less than or equal to
abstol
+
eps
*
max
(|
a
|,|
b
|)
,
where
eps
is the machine precision. If
abstol
is less than or equal to zero, then
eps
*norm(
T
) will be used in its place, where norm(
T
) is the 1-norm of the tridiagonal matrix obtained by reducing
A
to tridiagonal form.
Eigenvalues will be computed most accurately when
abstol
is set to twice the underflow threshold
2*
p?lamch
('S')
not zero. If this
function
returns with
((
mod
(
info
,2)
0).
or
. * (
mod
(
info
/8,2)
0))
, indicating that some eigenvalues or eigenvectors did not converge, try setting
abstol
to
2*
p?lamch
('S')
.
mod(
x
,
y
)
is the integer remainder of
x
/
y
.
orfac
(global).
Specifies which eigenvectors should be reorthogonalized. Eigenvectors that correspond to eigenvalues which are within
tol
=
orfac
*norm(
A
)
of each other are to be reorthogonalized. However, if the workspace is insufficient (see
lwork
),
tol
may be decreased until all eigenvectors to be reorthogonalized can be stored in one process. No reorthogonalization will be done if
orfac
equals zero. A default value of 1.0E-3 is used if
orfac
is negative.
orfac
should be identical on all processes.
iz
,
jz
(global) The row and column indices in the global matrix
Z
indicating the first row and the first column of the submatrix
Z
, respectively.
descz
(global and local) array of size
dlen_
. The array descriptor for the distributed matrix
Z
.
descz
[
ctxt_
- 1]
must equal
desca
[
ctxt_
- 1]
.
work
(local)
Workspace array of size
lwork
lwork
(local).
The size of the array
work
.
If only eigenvalues are requested:
lwork
n
+
max
(
NB
*(
np
0 + 1), 3)
If eigenvectors are requested:
lwork
n
+ (
np
0+
mq
0 +
NB
)*
NB
with
nq
0 =
numroc
(
nn
,
NB
, 0, 0,
NPCOL
)
.
For optimal performance, greater workspace is needed, that is
lwork
max
(
lwork
,
n
,
nhetrd_lwopt
,
nhegst_lwopt
)
where
lwork
is as defined above, and
nhetrd_lwork
= 2*(
anb
+1)*(4*
nps
+2) + (
nps
+ 1)*
nps
;
nhegst_lwopt
= 2*
np
0*
nb
+
nq
0*
nb
+
nb
*
nb
nb
=
desca
[
mb_
- 1]
np
0 =
numroc
(
n
,
nb
, 0, 0,
NPROW
)
nq
0 =
numroc
(
n
,
nb
, 0, 0,
NPCOL
)
ictxt
=
desca
[
ctxt_
- 1]
anb
=
pjlaenv
(
ictxt
, 3, '
p?hettrd
',
'L
', 0, 0, 0, 0)
sqnpc
=
sqrt
(
dble
(
NPROW
*
NPCOL
))
nps
=
max
(
numroc
(
n
, 1, 0, 0,
sqnpc
), 2*
anb
)
numroc
is a ScaLAPACK tool functions;
pjlaenv
is a ScaLAPACK environmental inquiry function
MYROW
,
MYCOL
,
NPROW
and
NPCOL
can be determined by calling the
function
blacs_gridinfo
.
If
lwork
= -1
, then
lwork
is global input and a workspace query is assumed; the
function
only calculates the size required for optimal performance for all work arrays. Each of these values is returned in the first entry of the corresponding work arrays, and no error message is issued by
pxerbla
.
rwork
(local)
Workspace array of size
lrwork
.
lrwork
(local) The size of the array
rwork
.
See below for definitions of variables used to define
lrwork
.
If no eigenvectors are requested (
jobz
=
'N'
), then
lrwork
≥ 5*
nn
+4*
n
If eigenvectors are requested (
jobz
=
'V'
), then the amount of workspace required to guarantee that all eigenvectors are computed is:
lrwork
≥ 4*
n
+
max
(5*
nn
,
np
0*
mq
0)+
iceil
(
neig
,
NPROW
*
NPCOL
)*
nn
The computed eigenvectors may not be orthogonal if the minimal workspace is supplied and
orfac
is too small. If you want to guarantee orthogonality (at the cost of potentially poor performance) you should add the following value to
lrwork
:
(
clustersize
-1)*
n
,
where
clustersize
is the number of eigenvalues in the largest cluster, where a cluster is defined as a set of close eigenvalues:
{
w
]
k
- 1],...,
w
[
k
+
clustersize
- 2]|
w
[
j
] ≤
w
[
j
- 1]+
orfac
*2*norm(
A
)}
Variable definitions:
neig
= number of eigenvectors requested;
nb
=
desca
[
mb_
- 1] =
desca
[
nb_
- 1] =
descz
[
mb_
- 1] =
descz
[
nb_
- 1];
nn
=
max
(
n
,
nb
, 2)
;
desca
[
rsrc_
- 1] =
desca
[
nb_
- 1] =
descz
[
rsrc_
- 1] =
descz
[
csrc_
- 1] = 0
;
np
0 =
numroc
(
nn
,
nb
, 0, 0,
NPROW
)
;
mq
0 =
numroc
(
max
(
neig
,
nb
, 2),
nb
, 0, 0,
NPCOL
);
iceil
(
x
,
y
)
is a ScaLAPACK function returning ceiling(
x
/
y
).
When
lrwork
is too small:
If
lwork
is too small to guarantee orthogonality, p?hegvx attempts to maintain orthogonality in the clusters with the smallest spacing between the eigenvalues.
If
lwork
is too small to compute all the eigenvectors requested, no computation is performed and
info
= -25 is returned. Note that when
range
=
'V'
,
p?hegvx
does not know how many eigenvectors are requested until the eigenvalues are computed. Therefore, when
range
=
'V'
and as long as
lwork
is large enough to allow
p?hegvx
to compute the eigenvalues,
p?hegvx
will compute the eigenvalues and as many eigenvectors as it can.
Relationship between workspace, orthogonality & performance:
If
clustersize
>
n
/
sqrt
(
NPROW
*
NPCOL
)
, then providing enough space to compute all the eigenvectors orthogonally will cause serious degradation in performance. In the limit (that is,
clustersize
=
n
-1
)
p?stein
will perform no better than
?stein
on 1 processor.
For
clustersize
=
n
/
sqrt
(
NPROW
*
NPCOL
)
reorthogonalizing all eigenvectors will increase the total execution time by a factor of 2 or more.
For
clustersize
>
n
/
sqrt
(
NPROW
*
NPCOL
)
execution time will grow as the square of the cluster size, all other factors remaining equal and assuming enough workspace. Less workspace means less reorthogonalization but faster execution.
If
lwork
= -1
, then
lrwork
is global input and a workspace query is assumed; the
function
only calculates the size required for optimal performance for all work arrays. Each of these values is returned in the first entry of the corresponding work arrays, and no error message is issued by
pxerbla
.
iwork
(local) Workspace array.
liwork
(local) , size of
iwork
.
liwork
≥ 6*
nnp
Where:
nnp
=
max
(
n
,
NPROW
*
NPCOL
+ 1, 4)
If
liwork
= -1
, then
liwork
is global input and a workspace query is assumed; the
function
only calculates the minimum and optimal size for all work arrays. Each of these values is returned in the first entry of the corresponding work array, and no error message is issued by
pxerbla
.
Output Parameters
a
On exit, if
jobz
=
'V'
, then if
info
= 0
, sub(
A
) contains the distributed matrix
Z
of eigenvectors.
The eigenvectors are normalized as follows:
If
ibtype
= 1 or 2
, then
Z
H
*sub(
B
)*
Z
=
i
;
If
ibtype
= 3
, then
Z
H
*inv(sub(
B
))*
Z
=
i
.
If
jobz
=
'N'
, then on exit the upper triangle (if
uplo
=
'U'
) or the lower triangle (if
uplo
=
'L'
) of sub(
A
), including the diagonal, is destroyed.
b
On exit, if
info
n
, the part of sub(
B
) containing the matrix is overwritten by the triangular factor
U
or
L
from the Cholesky factorization sub(
B
) =
U
H
*U
, or sub(
B
) =
L*L
H
.
m
(global) The total number of eigenvalues found,
0 ≤
m
n
.
nz
(global) Total number of eigenvectors computed.
0 <
nz
<
m
. The number of columns of
z
that are filled.
If
jobz
'V'
,
nz
is not referenced.
If
jobz
=
'V'
,
nz
=
m
unless the user supplies insufficient space and
p?hegvx
is not able to detect this before beginning computation. To get all the eigenvectors requested, the user must supply both sufficient space to hold the eigenvectors in
z
(
m
descz
[
n_
- 1]
)
and sufficient workspace to compute them. (See
lwork
below.) The
function
p?hegvx
is always able to detect insufficient space without computation unless
range
=
'V'
.
w
(global)
Array of size
n
. On normal exit, the first
m
entries contain the selected eigenvalues in ascending order.
z
(local).
global size
n
*
n
, local size
lld_z
*
LOCc
(
jz
+
n
-1)
.
If
jobz
=
'V'
, then on normal exit the first
m
columns of
z
contain the orthonormal eigenvectors of the matrix corresponding to the selected eigenvalues. If an eigenvector fails to converge, then that column of
z
contains the latest approximation to the eigenvector, and the index of the