# sygvd¶

Computes all eigenvalues and, optionally, eigenvectors of a real generalized symmetric definite eigenproblem using a divide and conquer method.

Description

sygvd supports the following precisions.

T

float

double

The routine computes all the eigenvalues, and optionally, the eigenvectors of a real generalized symmetric-definite eigenproblem, of the form

$$Ax = \lambda Bx$$, $$ABx = \lambda x$$, or $$BAx = \lambda x$$ .

Here $$A$$ and $$B$$ are assumed to be symmetric and $$B$$ is also positive definite.

It uses a divide and conquer algorithm.

## sygvd (Buffer Version)¶

Syntax

namespace oneapi::mkl::lapack {
void sygvd(cl::sycl::queue &queue, std::int64_t itype, oneapi::mkl::job jobz, oneapi::mkl::uplo upper_lower, std::int64_t n, cl::sycl::buffer<T,1> &a, std::int64_t lda, cl::sycl::buffer<T,1> &b, std::int64_t ldb, cl::sycl::buffer<T,1> &w, cl::sycl::buffer<T,1> &scratchpad, std::int64_t scratchpad_size)
}


Input Parameters

queue

The queue where the routine should be executed.

itype

Must be 1 or 2 or 3. Specifies the problem type to be solved:

if $$\text{itype} = 1$$, the problem type is $$Ax = \lambda Bx$$;

if $$\text{itype} = 2$$, the problem type is $$ABx = \lambda x$$;

if $$\text{itype} = 3$$, the problem type is $$BAx = \lambda x$$.

jobz

Must be job::novec or job::vec.

If jobz = job::novec, then only eigenvalues are computed.

If jobz = job::vec, then eigenvalues and eigenvectors are computed.

upper_lower

Must be uplo::upper or uplo::lower.

If upper_lower = job::upper, a and b store the upper triangular part of $$A$$ and $$B$$.

If upper_lower = job::lower, a and b stores the lower triangular part of $$A$$ and $$B$$.

n

The order of the matrices $$A$$ and $$B$$ $$(0 \le n)$$.

a

Buffer, size a(lda,*) contains the upper or lower triangle of the symmetric matrix $$A$$, as specified by upper_lower. The second dimension of a must be at least $$\max(1, n)$$.

lda

The leading dimension of a; at least $$\max(1, n)$$.

b

Buffer, size b (ldb,*) contains the upper or lower triangle of the symmetric matrix $$B$$, as specified by upper_lower. The second dimension of b must be at least $$\max(1, n)$$.

ldb

The leading dimension of b; at least $$\max(1, n)$$.

Size of scratchpad memory as a number of floating point elements of type T. Size should not be less than the value returned by sygvd_scratchpad_size function.

Output Parameters

a

On exit, if jobz = job::vec, then if $$\text{info} = 0$$, a contains the matrix $$Z$$ of eigenvectors. The eigenvectors are normalized as follows:

if $$\text{itype} = 1$$ or $$2$$ , $$Z^{T}BZ = I$$;

if $$\text{itype} = 3$$ , $$Z^{T}B^{-1}Z = I$$;

If jobz = job::novec, then on exit the upper triangle (if upper_lower = uplo::upper) or the lower triangle (if upper_lower = uplo::lower) of $$A$$, including the diagonal, is destroyed.

b

On exit, if $$\text{info} \le n$$, the part of b containing the matrix is overwritten by the triangular factor $$U$$ or $$L$$ from the Cholesky factorization $$B = U^{T}U$$ or $$B = LL^{T}$$.

w

Buffer, size at least $$n$$. If $$\text{info} = 0$$, contains the eigenvalues of the matrix $$A$$ in ascending order.

Buffer holding scratchpad memory to be used by routine for storing intermediate results.

Throws

This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.

oneapi::mkl::unimplemented

oneapi::mkl::unsupported_device

oneapi::mkl::lapack::invalid_argument

oneapi::mkl::lapack::computation_error

Exception is thrown in case of problems during calculations. The info code of the problem can be obtained by info() method of exception object:

If $$\text{info}=-i$$, the $$i$$-th parameter had an illegal value.

For $$\text{info} \le n$$:

If $$\text{info}=i$$, and jobz = oneapi::mkl::job::novec, then the algorithm failed to converge; $$i$$ indicates the number of off-diagonal elements of an intermediate tridiagonal form which did not converge to zero.

If $$\text{info}=i$$, and jobz = oneapi::mkl::job::vec, then the algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columns $$\text{info}/(n+1)$$ through $$\text{mod}(\text{info},n+1)$$.

For $$\text{info}>n$$:

If $$\text{info}=n+i$$, for $$1 \le i \le n$$, then the leading minor of order $$i$$ of $$B$$ is not positive-definite. The factorization of $$B$$ could not be completed and no eigenvalues or eigenvectors were computed.

If info equals to value passed as scratchpad size, and detail() returns non zero, then passed scratchpad is of insufficient size, and required size should not be less than value return by detail() method of exception object.

## sygvd (USM Version)¶

Syntax

namespace oneapi::mkl::lapack {
cl::sycl::event sygvd(cl::sycl::queue &queue, std::int64_t itype, oneapi::mkl::job jobz, oneapi::mkl::uplo upper_lower, std::int64_t n, T *a, std::int64_t lda, T *b, std::int64_t ldb, T *w, T *scratchpad, std::int64_t scratchpad_size, const std::vector<cl::sycl::event> &events = {})
}


Input Parameters

queue

The queue where the routine should be executed.

itype

Must be 1 or 2 or 3. Specifies the problem type to be solved:

if $$\text{itype} = 1$$, the problem type is $$Ax = \lambda Bx$$;

if $$\text{itype} = 2$$, the problem type is $$ABx = \lambda x$$;

if $$\text{itype} = 3$$, the problem type is $$BAx = \lambda x$$.

jobz

Must be job::novec or job::vec.

If jobz = job::novec, then only eigenvalues are computed.

If jobz = job::vec, then eigenvalues and eigenvectors are computed.

upper_lower

Must be uplo::upper or uplo::lower.

If upper_lower = job::upper, a and b store the upper triangular part of $$A$$ and $$B$$.

If upper_lower = job::lower, a and b stores the lower triangular part of $$A$$ and $$B$$.

n

The order of the matrices $$A$$ and $$B$$ $$(0 \le n)$$.

a

Pointer to array of size a(lda,*) containing the upper or lower triangle of the symmetric matrix $$A$$, as specified by upper_lower. The second dimension of a must be at least $$\max(1, n)$$.

lda

The leading dimension of a; at least $$\max(1, n)$$.

b

Pointer to array of size b (ldb,*) contains the upper or lower triangle of the symmetric matrix $$B$$, as specified by upper_lower. The second dimension of b must be at least $$\max(1, n)$$.

ldb

The leading dimension of b; at least $$\max(1, n)$$.

Size of scratchpad memory as a number of floating point elements of type T. Size should not be less than the value returned by sygvd_scratchpad_size function.

events

List of events to wait for before starting computation. Defaults to empty list.

Output Parameters

a

On exit, if jobz = job::vec, then if $$\text{info} = 0$$, $$a$$ contains the matrix $$Z$$ of eigenvectors. The eigenvectors are normalized as follows:

if $$\text{itype} = 1$$ or $$2$$, $$Z^{T}BZ = I$$;

if $$\text{itype} = 3$$, $$Z^{T}B^{-1}Z = I$$;

If jobz = job::novec, then on exit the upper triangle (if upper_lower = uplo::upper) or the lower triangle (if upper_lower = uplo::lower) of $$A$$, including the diagonal, is destroyed.

b

On exit, if $$\text{info} \le n$$, the part of b containing the matrix is overwritten by the triangular factor $$U$$ or $$L$$ from the Cholesky factorization $$B$$ = $$U^{T}U$$ or $$B = LL^{T}$$.

w

Pointer to array of size at least n. If $$\text{info} = 0$$, contains the eigenvalues of the matrix $$A$$ in ascending order.

Pointer to scratchpad memory to be used by routine for storing intermediate results.

Throws

This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.

oneapi::mkl::unimplemented

oneapi::mkl::unsupported_device

oneapi::mkl::lapack::invalid_argument

oneapi::mkl::lapack::computation_error

Exception is thrown in case of problems during calculations. The info code of the problem can be obtained by info() method of exception object:

If $$\text{info}=-i$$, the $$i$$-th parameter had an illegal value.

For $$\text{info} \le n$$:

If $$\text{info}=i$$, and jobz = oneapi::mkl::job::novec, then the algorithm failed to converge; $$i$$ indicates the number of off-diagonal elements of an intermediate tridiagonal form which did not converge to zero.

If $$\text{info}=i$$, and jobz = oneapi::mkl::job::vec, then the algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columns $$\text{info}/(n+1)$$ through $$\text{mod}(\text{info},n+1)$$.

For $$\text{info}>n$$:

If $$\text{info}=n+i$$, for $$1 \le i \le n$$, then the leading minor of order $$i$$ of $$B$$ is not positive-definite. The factorization of $$B$$ could not be completed and no eigenvalues or eigenvectors were computed.

If info equals to value passed as scratchpad size, and detail() returns non zero, then passed scratchpad is of insufficient size, and required size should not be less than value return by detail() method of exception object.

Return Values

Output event to wait on to ensure computation is complete