Visible to Intel only — GUID: GUID-71D45F6C-E5E1-454A-8987-FDB9E8566061
Visible to Intel only — GUID: GUID-71D45F6C-E5E1-454A-8987-FDB9E8566061
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 |
---|---|
float |
CPU and GPU |
double |
CPU and GPU |
std::complex<float> |
CPU and GPU |
std::complex<double> |
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::nontrans or mkl::transpose::trans Complex precisions: mkl::tranpose::nontrans or mkl::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 matrix Bi must be allocated enough space to store the solution vectors Xi, i.e. max(m,n)-by-nrhs
If trans = transpose::nontrans then Bi is m-by-nrhs, otherwise Bi is n-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 g specifies the number of problems to solve for each group of parameters g. 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. The tau vectors are not recorded.
- b
-
Overwritten by least squares solutions of the batch of problems.
Exceptions
Exception |
Description |
---|---|
mkl::lapack::batch_exception |
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 info = -i, the i-th parameter had an illegal value. If info equals the value passed as scratchpad size, and detail() returns non-zero, then the passed scratchpad is of insufficient size, and the required size should be not less then value returned by the detail() method of the exception object. If info is zero, then Ai does not have full rank, and the solve could not be completed. The indexes of such matrices in the batch can be obtained with the ids() method of the exception object. You can obtain the indexes of the first zero diagonal elements in these matrices using the infos() method of the exception object. |
Return Values
Output event to wait on to ensure computation is complete.