Visible to Intel only — GUID: GUID-4BCB2975-80AD-459F-8ADC-027E3886A67A
Visible to Intel only — GUID: GUID-4BCB2975-80AD-459F-8ADC-027E3886A67A
gels (USM Version)
Finds the least squares solution of an overdetermined linear system or the minimum norm solution of an underdetermined system. This routine belongs to the oneapi::mkl::lapack namespace.
Description
Uses the QR factorization to solve a linear system 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
m < n is not supported.
On exit, the contents of B is overwritten with the solution vectors X.
API
Syntax
namespace oneapi::mkl::lapack {
sycl::event gels(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,
T *scratchpad,
int64_t scratchpad_size,
const std::vector<sycl::event> &events = {})
}
gels (USM version) 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
-
Operation applied to matrix A. Real precisions: mkl::tranpose::nontrans or mkl::transpose::trans Complex precisions: mkl::tranpose::nontrans or mkl::transpose::conjtrans
- m
-
The number of rows of the matrix A (m ≥ n ≥ 0).
- n
-
The number of columns of the matrix A (m ≥ n ≥ 0).
- nrhs
-
The number of right-hand sides: the number of columns in B (nrhs ≥ 0).
- a
-
Pointer to the memory holding input matrix A.
- lda
-
The leading dimension of a (lda ≥ max(1,m)).
- b
-
Pointer to the memory holding input matrix B of right hand side vectors. B must be allocated enough space to store the solution vectors X, i.e. max(m,n)-by-nrhs
If trans = transpose::nontrans then B is m-by-nrhs, otherwise B is n-by-nrhs.
- ldb
-
The leading dimension of b (ldb ≥ max(1, max(m,n))).
- scratchpad
-
Pointer to scratchpad memory to be used by the 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 the gels_scratchpad_size function.
- 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 A used in least squares computation.
- b
-
Overwritten by least squares solutions of the problem.
Exceptions
Exception |
Description |
---|---|
mkl::lapack::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 is equal to the value passed as scratchpad size, and detail() returns non zero, then the passed scratchpad has an insufficient size, and the required size must not be less than the value returned by the detail() method of the exception object. |
Return Values
Output event to wait on to ensure computation is complete.