gels_batch (USM Strided Version)#
Finds the least squares solutions for a batch of overdetermined linear systems. This routine belongs to the oneapi::mkl::lapack namespace.
Description#
Uses the QR factorization to solve a batch of linear systems with full rank matrices. Each linear system is solved according to the following:
If m ≥ n and trans = transpose::nontrans the least squares solution to the
overdetermined system is computed:
min ||A*X - B||
If m ≥ n and trans = (transpose::trans or tranpose::conjtrans) the minimal
norm solution to the underdetermined system is computed:
min ||X|| s.t. AH *X = B
On exit, the contents of B is overwritten with the solution vectors X.
Currently only m ≥ n and trans = transpose::nontrans case is supported.
API#
Syntax#
namespace oneapi::mkl::lapack {
sycl::event gels_batch(sycl::queue &queue,
mkl::transpose trans,
int64_t m,
int64_t n,
int64_t nrhs,
T *a,
int64_t lda,
int64_t stride_a,
T *b,
int64_t ldb,
int64_t stride_b,
int64_t batch_size,
T *scratchpad,
int64_t scratchpad_size,
const std::vector<sycl::event> &events = {})
}
This function supports the following precisions and devices:
T |
Devices supported |
|---|---|
|
GPU |
|
GPU |
|
GPU |
|
GPU |
Input Parameters#
- queue
Device queue where calculations will be performed.
- trans
Operation applied to matrices
Ai. Real precisions:mkl::tranpose::nontransormkl::transpose::transComplex precisions:mkl::tranpose::nontransormkl::transpose::conjtrans- m
The number of rows of the matrices
Ai (m ≥ n ≥ 0).- n
The number of columns of the matrices
Ai (m ≥ n ≥ 0).- nrhs
The number of right-hand sides: the number of columns in
Bi (nrhs ≥ 0).- a
Contains batch_size m-by-n matrices
Ai- lda
The leading dimension of
Ai (lda≥max(1,m)).- stride_a
The stride between the beginnings of matrices
Ai inside the batch arraya(stride_a≥max(1, lda * n)).- b
Contains the matrices
Bi of right hand side vectors. Each matrixBi must be allocated enough space to store the solution vectorsXi, i.e.max(m,n)-by-nrhsIf
trans = transpose::nontransthenBi ism-by-nrhs, otherwiseBi isn-by-nrhs.- ldb
The leading dimensions of
Bi (ldb≥max(1,max(m,n))).- stride_b
The stride between the beginnings of matrices
Bi inside the batch arrayb(stride_b≥max(1, ldb * nrhs)).- batch_size
The number of problems in a batch (
batch_size≥ 0).- scratchpad
Scratchpad memory to be used by routine for storing intermediate results.
- 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 stride version of gels_batch_scratchpad_size (Strided Version).
- events
List of events to wait for before starting computation. Defaults to empty list.
Output Parameters#
- a
Overwritten by the factorization data as follows: Contains triangular matrix R obtained on the basis of
Ai used in least squares computation. Thetauvectors are not recorded.- b
Overwritten by least squares solutions of the batch of problems.
Exceptions#
Exception |
Description |
|---|---|
|
This exception is thrown when problems occur during calculations. You can obtain the info code of the problem using the info() method of the exception object: If If If |
Return Values#
Output event to wait on to ensure computation is complete.