trsm_batch¶
Computes groups of matrix-matrix product with general matrices.
Syntax
Group API
-
event
trsm_batch
(queue &exec_queue, side *left_right, uplo *upper_lower, transpose *trans, diag *unit_diag, std::int64_t *m, std::int64_t *n, T alpha, T **a, std::int64_t *lda, std::int64_t *stridea, T **b, std::int64_t *ldb, std::int64_t *strideb, std::int64_t group_count, std::int64_t *groupsize, const vector_class<event> &dependencies = {})¶
Strided API
-
void
trsm_batch
(queue &exec_queue, side left_right, uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, T alpha, buffer<T, 1> &a, std::int64_t lda, std::int64_t stridea, buffer<T, 1> &b, std::int64_t ldb, std::int64_t strideb, std::int64_t batch_size)¶
-
event
trsm_batch
(queue &exec_queue, side left_right, uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, T alpha, T *a, std::int64_t lda, std::int64_t stridea, T *b, std::int64_t ldb, std::int64_t strideb, std::int64_t batch_size, const vector_class<event> &dependencies = {})¶
trsm_batch
supports the following precisions and devices.
T |
Devices Supported |
---|---|
|
Host, CPU, and GPU |
|
Host, CPU, and GPU |
|
Host, CPU, and GPU |
|
Host, CPU, and GPU |
Description
The trsm_batch routines solve a series of equations of the form op(A) * X = alpha * B or X * op(A) = alpha * B. They are similar to the trsm routine counterparts, but the trsm_batch routines solve linear equations with groups of matrices. The groups contain matrices with the same parameters.
The operation for the strided API is defined as
for i = 0 … batch_size – 1
A and B are matrices at offset i * stridea and i * strideb in a and b.
if (left_right == mkl::side::L) then
computes X such that op(A) * X = alpha * B
else
computes X such that X * op(A) = alpha * B
end if
B := X
end for
The operation for the group API is defined as
idx = 0
for i = 0 … group_count – 1
left_right, upper_lower, alpha, and group_size at position i in their respective arrays.
for j = 0 … group_size – 1
A, and B are matrices at position idx in A_array, and B_array
if (left_right == mkl::side::L) then
computes X such that op(A) * X = alpha * B
else
computes X such that X * op(A) = alpha * B
end if
B:= X
idx := idx + 1
end for
end for
where:
op(
A
) is one of op(A
) =A
, orop(A)
=A
T, or op(A
) =A
Halpha is a scalar
A
is a triangular matrixB
andX
arem
xn
general matricesThe
a
andb
buffers (arrays, for USM API) contains all the input matrices. The stride between matrices is either given by the exact size of the matrix or by the stride parameter. The total number of matrices ina
andb
is given by the.
The
a
andb
arrays contains pointers to all the input matrices. The total number of matrices ina
andb
is given by the.
A
is either m
x m
or n
x n
,depending on whether
it multiplies X
on the leftor right. On return, the matrix B
is overwrittenby the solution matrix X
.
Input Parameters
Strided API
- left_right
Specifies whether the matrices
A
multiplyX
on the left (side::left
) or on the right (side::right
). See Data Types for more details.- uplo
Specifies whether the matrices
A
are upper or lower triangular. See Data Types for more details.- trans
Specifies
op(A)
, the transposition operation applied to the matricesA
. See Data Types for more details.- unit_diag
Specifies whether the matrices
A
are assumed to be unit triangular (all diagonal elements are 1.). See Data Types for more details.- m
Number of rows of the
B
matrices. Must be at least zero.- n
Number of columns of the
B
matrices. Must be at least zero.- alpha
Scaling factor for the solutions.
- a
Buffer holding the input matrices
A
. Must have size at leaststridea*batch_size
.- lda
Leading dimension of the matrices
A
. Must be at leastm
if left_right =side::left
, and at leastn
if left_right =side::right
. Must be positive.- stridea
Stride between the different
A
matrices.If left_right =
side::left
, the matricesA
arem
-by-m
matrices, so stridea must be at least lda*m
.If left_right =
side::right
, the matricesA
aren
-by-n
matrices, so stridea must be at least lda*n
.- b
Buffer holding the input matrices
B
. Must have size at leaststrideb*batch_size
.- ldb
Leading dimension of the matrices
B
. If matrices are stored column major,ldb
must be at leastm
ldb
. If matrices are stored row major,ldb
must be at leastn
. must be positive.- strideb
Stride between the different
B
matrices. If matrices are stored column-major,strideb
must be at leastldb
*n
. If matrices are stored row-major,strideb
must be at leastldb
*m
”.- beta
Scaling factor for the matrices
C
.- batch_size
Specifies the number of triangular linear systems to solve.
Group API
- left_right
Array of size
group_count
which specifies whether the matricesA
in each group multiply eachX
in the same group on the left (side::left
) or on the right (side::right
). See Data Types for more details.- uplo
Array of size
group_count
which specifies whether the matricesA
in each group are upper or lower triangular. See Data Types for more details.- trans
Array of size
group_count
which specifiesop(A)
, the transposition operation applied to the matricesA
in each group. See Data Types for more details.- unit_diag
Array of size
group_count
which specifies whether the matricesA
in each group are assumed to be unit triangular (all diagonal elements are 1.). See Data Types for more details.- m
Array of size
group_count
which the number of rows of eachB
matrices in each group. Each must be at least zero.- n
Array of size
group_count
which the number of columns of eachB
matrices in each group. Each must be at least zero.- alpha
Array of size
group_count
containing scaling factors for the solutions in each group.- a
Array of size
total_batch_count
holding pointers to eachA
matrix. If left_righti =side::left
, the matricesA
arem
-by-m
matrices, so strideai must be at leastlda
i*m
i. If left_righti =side::right
, the matricesA
aren
-by-n
matrices, so strideai must be at leastlda
i*n
i.- lda
Array of size
group_count
containing leading dimensions of the matricesA
in each group. Must be at leastm
i if left_righti =side::left
, and at leastn
i if left_righti =side::right
. Each must be positive.- b
Array of size
total_batch_count
holding pointers to eachB
matrix. If matrices are stored column-major,strideb
i must be at leastldb
i*n
i. If matrices are stored row-major,strideb
i must be at leastldb
i*m
i.- ldb
Array of size
group_count
, containing leading dimensions of the matricesB
in each group. If matrices are stored column major, allldb
i must be at leastm
i. If matrices are stored row major, allldb
i must be at leastn
i. Eachldb
i must be positive.- beta
Scaling factor for the matrices
C
.- batch_size
Specifies the number of triangular linear systems to solve.
Output Parameters
Strided API
- b(Buffer API)
Output buffer, overwritten by
batch_size
solution matricesX
.- b(USM API)
Output array, overwritten by
batch_size
solution matricesX
.
Group API
- b
Output array, containing pointers to arrays overwritten by
batch_size
solution matricesX
.
Notes
If alpha
= 0, matrix B
is set to zero, and the matrices A
and B
do not need to be initialized before calling trsm_batch.