Files
cppdraft_translate/cppdraft/linalg/algs/blas3/inplacetrsm.md
2025-10-25 03:02:53 +03:00

9.7 KiB
Raw Blame History

[linalg.algs.blas3.inplacetrsm]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.15 BLAS 3 algorithms [linalg.algs.blas3]

29.9.15.7 Solve multiple triangular linear systems in-place [linalg.algs.blas3.inplacetrsm]

1

#

[Note 1:

These functions correspond to the BLAS function xTRSM[bib].

— end note]

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class BinaryDivideOp> void triangular_matrix_matrix_left_solve(InMat A, Triangle t, DiagonalStorage d, InOutMat B, BinaryDivideOp divide); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class BinaryDivideOp> void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutMat B, BinaryDivideOp divide);

2

#

These functions perform multiple in-place matrix solves, taking into account the Triangle and DiagonalStorage parameters that apply to the triangular matrix A ([linalg.general]).

[Note 2:

This algorithm makes it possible to compute factorizations like Cholesky and LU in place.

Performing triangular solve in place hinders parallelization.

However, other ExecutionPolicy specific optimizations, such as vectorization, are still possible.

— end note]

3

#

Mandates:

If InMat has layout_blas_packed layout, then the layout's Triangle template argument has the same type as the function's Triangle template argument;

possibly-multipliable<InMat, InOutMat, InOutMat>() is true; and

compatible-static-extents<InMat, InMat>(0, 1) is true.

4

#

Preconditions:

multipliable(A, B, B) is true, and

A.extent(0) == A.extent(1) is true.

5

#

Effects: Computes X′ such that AX′=B, and assigns each element of X′ to the corresponding element of B.

If so such X′ exists, then the elements of B are valid but unspecified.

6

#

Complexity: O(A.extent(0)×A.extent(1)×B.extent(1)).

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void triangular_matrix_matrix_left_solve(InMat A, Triangle t, DiagonalStorage d, InOutMat B);

7

#

Effects: Equivalent to:triangular_matrix_matrix_left_solve(A, t, d, B, divides{});

🔗

template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutMat B);

8

#

Effects: Equivalent to:triangular_matrix_matrix_left_solve(std::forward(exec), A, t, d, B, divides{});

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class BinaryDivideOp> void triangular_matrix_matrix_right_solve(InMat A, Triangle t, DiagonalStorage d, InOutMat B, BinaryDivideOp divide); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class BinaryDivideOp> void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutMat B, BinaryDivideOp divide);

9

#

These functions perform multiple in-place matrix solves, taking into account the Triangle and DiagonalStorage parameters that apply to the triangular matrix A ([linalg.general]).

[Note 3:

This algorithm makes it possible to compute factorizations like Cholesky and LU in place.

Performing triangular solve in place hinders parallelization.

However, other ExecutionPolicy specific optimizations, such as vectorization, are still possible.

— end note]

10

#

Mandates:

If InMat has layout_blas_packed layout, then the layout's Triangle template argument has the same type as the function's Triangle template argument;

possibly-multipliable<InOutMat, InMat, InOutMat>() is true; and

compatible-static-extents<InMat, InMat>(0, 1) is true.

11

#

Preconditions:

multipliable(B, A, B) is true, and

A.extent(0) == A.extent(1) is true.

12

#

Effects: Computes X′ such that X′A=B, and assigns each element of X′ to the corresponding element of B.

If so such X′ exists, then the elements of B are valid but unspecified.

13

#

Complexity: O(A.extent(0)×A.extent(1)×B.extent(1)).

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void triangular_matrix_matrix_right_solve(InMat A, Triangle t, DiagonalStorage d, InOutMat B);

14

#

Effects: Equivalent to:triangular_matrix_matrix_right_solve(A, t, d, B, divides{});

🔗

template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutMat B);

15

#

Effects: Equivalent to:triangular_matrix_matrix_right_solve(std::forward(exec), A, t, d, B, divides{});