gesv (USM Version)#

Computes the solution to the system of linear equations with a square coefficient matrix and multiple right-hand sides. This routine belongs to the oneapi::mkl::lapack namespace.

Description#

The routine solves for X the system of linear equations A*X = B, where A is an n-by-n matrix, the columns of matrix B are individual right-hand sides, and the columns of X are the corresponding solutions.

The LU decomposition with partial pivoting and row interchanges is used to factor A as A = P*L*U, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations A*X = B.

API#

Syntax#

namespace oneapi::mkl::lapack {
  sycl::event gesv(sycl::queue &queue,
  int64_t n,
  int64_t nrhs,
  T *a,
  int64_t lda,
  int64_t *ipiv,
  T *b,
  int64_t ldb,
  T *scratchpad,
  int64_t scratchpad_size,
  const std::vector<sycl::event> &events = {})
}

gesv (USM version) supports the following precisions and devices:

T

Devices supported

float

CPU, GPU

double

CPU, GPU

std::complex<float>

CPU, GPU

std::complex<double>

CPU, GPU

Input Parameters#

queue

Device queue where calculations will be performed.

n

The order of the matrix A; (0 n).

nrhs

The number of right-hand sides (0 nrhs).

a

Pointer to the n-by-n coefficient matrix A.

lda

The leading dimension of a.

b

Pointer to the n-by-nrhs matrix of right hand side matrix B

ldb

The leading dimension of b.

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 should not be less than the value returned by the gesv_scratchpad_size function.

events

List of events to wait for before starting computation. Defaults to empty list.

Output Parameters#

a

Overwritten by the factors L and U from the factorization of A = P*L*U; the unit diagonal elements of L are not stored.

b

The buffer b is overwritten by the solution matrix X.

ipiv

Array, size at least max(1, n). The ipiv array, as returned by getrf (USM Version).

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 = i, the i-th diagonal element of U is zero, and the solve could not be completed.

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 should 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.