gels_batch (Group 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 grouped 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 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,
T **b,
int64_t *ldb,
int64_t group_count,
int64_t *group_sizes,
T *scratchpad,
int64_t scratchpad_size,
const std::vector<sycl::event> &events = {})
}
This function supports the following precisions and devices:
T |
Devices supported |
|---|---|
|
CPU and GPU |
|
CPU and GPU |
|
CPU and GPU |
|
CPU and GPU |
Input Parameters#
- queue
Device queue where calculations will be performed.
- trans
Array of group_count parameters trans g. Operation applied to matrices
Ai in group g. Real precisions:mkl::tranpose::nontransormkl::transpose::transComplex precisions:mkl::tranpose::nontransormkl::transpose::conjtrans- m
Array of group_count parameters m g The number of rows of the matrices
Ai in group g (m ≥ n ≥ 0).- n
Array of group_count parameters n g The number of columns of the matrices
Ai in group g (m ≥ n ≥ 0).- nrhs
Array of group_count parameters nrhs g The number of right-hand sides: the number of columns in
Bi in group g (nrhs ≥ 0).- a
Array of batch_size pointers. Contains batch_size m-by-n matrices
Ai- lda
Array of group_count parameters lda g The leading dimension of
Ai in group g (lda≥max(1,m)).- b
Array of batch_size pointers Contains the matrices
Bi of right hand side vectors in group g. 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
Array of group_count parameters ldb g The leading dimensions of
Bi in group g (ldb≥max(1,max(m,n))).- group_count
Specifies the number of groups of parameters. Must be at least 0.
- group_sizes
Array of group_count integers group_sizes g Array element with index
gspecifies the number of problems to solve for each group of parametersg. So the total number of problems to solve,batch_size, is a sum of all parameter group sizes.- 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 must not be less than the value returned by gels_batch_scratchpad_size (Group 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.