gesvd
Contents
gesvd#
Computes the singular value decomposition of a general rectangular matrix.
Description
gesvd
supports the following precisions.
T
float
double
std::complex<float>
std::complex<double>
gesvd (Buffer Version)#
Description
The routine computes the singular value decomposition (SVD) of a
real/complex
where
Syntax
namespace oneapi::mkl::lapack {
void gesvd(cl::sycl::queue &queue, oneapi::mkl::job jobu, oneapi::mkl::job jobvt, std::int64_t m, std::int64_t n, cl::sycl::buffer<T,1> &a, std::int64_t lda, cl::sycl::buffer<realT,1> &s, cl::sycl::buffer<T,1> &u, std::int64_t ldu, cl::sycl::buffer<T,1> &vt, std::int64_t ldvt, cl::sycl::buffer<T,1> &scratchpad, std::int64_t scratchpad_size)
}
Input Parameters
- queue
The queue where the routine should be executed.
- jobu
Must be
job::allvec
,job::somevec
,job::overwritevec
, orjob::novec
. Specifies options for computing all or part of the matrix .If
jobu = job::allvec
, all columns of are returned in the bufferu
;if
jobu = job::somevec
, the first columns of (the left singular vectors) are returned in the bufferu
;if
jobu = job::overwritevec
, the first columns of (the left singular vectors) are overwritten on the buffer a;if
jobu = job::novec
, no columns of (no left singular vectors) are computed.- jobvt
Must be
job::allvec, job::somevec
,job::overwritevec
, orjob::novec
. Specifies options for computing all or part of the matrix .If
jobvt = job::allvec
, all columns of are returned in the buffer vt;if
jobvt = job::somevec
, the first columns of (the left singular vectors) are returned in the buffer vt;if
jobvt = job::overwritevec
, the first columns of (the left singular vectors) are overwritten on the buffera
;if
jobvt = job::novec
, no columns of (no left singular vectors) are computed.jobvt
andjobu
cannot both bejob::overwritevec
.- m
The number of rows in the matrix
( ).- a
The buffer
a
, size(lda,*)
. The buffera
contains the matrix . The second dimension ofa
must be at least .- lda
The leading dimension of
a
.- ldu
The leading dimension of
u
.- ldvt
The leading dimension of
vt
.- scratchpad_size
Size of scratchpad memory as a number of floating point elements of type
T
. Size should not be less than the value returned by gesvd_scratchpad_size function.
Output Parameters
- a
On exit,
If
jobu = job::overwritevec
,a
is overwritten with the first columns of (the left singular vectors stored columnwise);If
jobvt = job::overwritevec
,a
is overwritten with the first rows of / (the right singular vectors stored rowwise);If
jobu
job::overwritevec
andjobvt
job::overwritevec
, the contents of a are destroyed.- s
Buffer containing the singular values, size at least
. Contains the singular values of sorted so that .- u
Buffer containing
; the second dimension ofu
must be at least ifjobu = job::allvec
, and at least ifjobu = job::somevec
.If
jobu = job::allvec
,u
contains the orthogonal/unitary matrix .If
jobu = job::somevec
,u
contains the first columns of (the left singular vectors stored column-wise).If
jobu = job::novec
orjob::overwritevec
,u
is not referenced.- vt
Buffer containing
; the second dimension ofvt
must be at least .If
jobvt = job::allvec
,vt
contains the orthogonal/unitary matrix / .If
jobvt = job::somevec
,vt
contains the first rows of / (the right singular vectors stored row-wise).If
jobvt = job::novec
orjob::overwritevec
,vt
is not referenced.- scratchpad
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::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
info=-i
, the-th parameter had an illegal value. If
info=i
, then ifbdsqr
did not converge,specifies how many superdiagonals of the intermediate bidiagonal form did not converge to zero, and scratchpad(2:min(m,n))
contains the unconverged superdiagonal elements of an upper bidiagonal matrixwhose diagonal is in s
(not necessarily sorted).satisfies , so it has the same singular values as , and singular vectors related by and . 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.
gesvd (USM Version)#
Description
The routine computes the singular value decomposition (SVD) of a
real/complex
where
Syntax
namespace oneapi::mkl::lapack {
cl::sycl::event gesvd(cl::sycl::queue &queue, oneapi::mkl::job jobu, oneapi::mkl::job jobvt, std::int64_t m, std::int64_t n, T *a, std::int64_t lda, RealT *s, T *u, std::int64_t ldu, T *vt, std::int64_t ldvt, 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.
- jobu
Must be
job::allvec
,job::somevec
,job::overwritevec
, orjob::novec
. Specifies options for computing all or part of the matrix .If
jobu = job::allvec
, all columns of are returned in the arrayu
;if
jobu = job::somevec
, the first columns of (the left singular vectors) are returned in the arrayu
;if
jobu = job::overwritevec
, the first columns of (the left singular vectors) are overwritten on the array a;if
jobu = job::novec
, no columns of (no left singular vectors) are computed.- jobvt
Must be
job::allvec, job::somevec
,job::overwritevec
, orjob::novec
. Specifies options for computing all or part of the matrix .If
jobvt = job::allvec
, all columns of are returned in the arrayvt
;if
jobvt = job::somevec
, the first columns of (the left singular vectors) are returned in the array vt;if
jobvt = job::overwritevec
, the first columns of (the left singular vectors) are overwritten on the arraya
;if
jobvt = job::novec
, no columns of (no left singular vectors) are computed.jobvt
andjobu
cannot both bejob::overwritevec
.- m
The number of rows in the matrix
( ).- a
Pointer to array
a
, size(lda,*)
, containing the matrix . The second dimension ofa
must be at least .- lda
The leading dimension of
a
.- ldu
The leading dimension of
u
.- ldvt
The leading dimension of
vt
.- scratchpad_size
Size of scratchpad memory as a number of floating point elements of type
T
. Size should not be less than the value returned by gesvd_scratchpad_size function.- events
List of events to wait for before starting computation. Defaults to empty list.
Output Parameters
- a
On exit,
If
jobu = job::overwritevec
,a
is overwritten with the first columns of (the left singular vectors stored columnwise);If
jobvt = job::overwritevec
,a
is overwritten with the first rows of / (the right singular vectors stored rowwise);If
jobu
job::overwritevec
andjobvt
job::overwritevec
, the contents of a are destroyed.- s
Array containing the singular values, size at least
. Contains the singular values of sorted so that .- u
Array containing
; the second dimension ofu
must be at least ifjobu = job::allvec
, and at least ifjobu = job::somevec
.If
jobu = job::allvec
,u
contains the orthogonal/unitary matrix .If
jobu = job::somevec
,u
contains the first columns of (the left singular vectors stored column-wise).If
jobu = job::novec
orjob::overwritevec
,u
is not referenced.- vt
Array containing
; the second dimension ofvt
must be at least .If
jobvt = job::allvec
,vt
contains the orthogonal/unitary matrix / .If
jobvt = job::somevec
,vt
contains the first rows of / (the right singular vectors stored row-wise).If
jobvt = job::novec
orjob::overwritevec
,vt
is not referenced.- scratchpad
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::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
info=-i
, the-th parameter had an illegal value. If
info=i
, then ifbdsqr
did not converge,specifies how many superdiagonals of the intermediate bidiagonal form did not converge to zero, and scratchpad(2:min(m,n))
contains the unconverged superdiagonal elements of an upper bidiagonal matrixwhose diagonal is in s
(not necessarily sorted).satisfies , so it has the same singular values as , and singular vectors related by and . 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.
Parent topic: LAPACK Singular Value and Eigenvalue Problem Routines