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

8.1 KiB
Raw Blame History

[linalg.algs.blas2.trmv]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.14 BLAS 2 algorithms [linalg.algs.blas2]

29.9.14.4 Triangular matrix-vector product [linalg.algs.blas2.trmv]

1

#

[Note 1:

These functions correspond to the BLAS functionsxTRMV and xTPMV[bib].

— end note]

2

#

The following elements apply to all functions in [linalg.algs.blas2.trmv].

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;

compatible-static-extents<decltype(A), decltype(A)>(0, 1) is true;

compatible-static-extents<decltype(A), decltype(y)>(0, 0) is true;

compatible-static-extents<decltype(A), decltype(x)>(0, 0) is true for those overloads that take an x parameter; and

compatible-static-extents<decltype(A), decltype(z)>(0, 0) is true for those overloads that take a z parameter.

4

#

Preconditions:

A.extent(0) equals A.extent(1),

A.extent(0) equals y.extent(0),

A.extent(0) equals x.extent(0) for those overloads that take an x parameter, and

A.extent(0) equals z.extent(0) for those overloads that take a z parameter.

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [out-vector](linalg.helpers.concepts#concept:out-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") OutVec> void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d, InVec x, OutVec y); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [out-vector](linalg.helpers.concepts#concept:out-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") OutVec> void triangular_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InVec x, OutVec y);

5

#

These functions perform an overwriting triangular matrix-vector product, taking into account the Triangle and DiagonalStorage parameters that apply to the triangular matrix A ([linalg.general]).

6

#

Effects: Computes y=Ax.

7

#

Complexity: O(x.extent(0)×A.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-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec> void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d, InOutVec y); 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-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec> void triangular_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutVec y);

8

#

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

[Note 2:

Performing this operation in place hinders parallelization.

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

— end note]

9

#

Effects: Computes a vector y′ such that y′=Ay, and assigns each element of y′ to the corresponding element of y.

10

#

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

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec1, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec2, [out-vector](linalg.helpers.concepts#concept:out-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") OutVec> void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d, InVec1 x, InVec2 y, OutVec z); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, class DiagonalStorage, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec1, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec2, [out-vector](linalg.helpers.concepts#concept:out-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") OutVec> void triangular_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InVec1 x, InVec2 y, OutVec z);

11

#

These functions perform an updating triangular matrix-vector product, taking into account the Triangle and DiagonalStorage parameters that apply to the triangular matrix A ([linalg.general]).

12

#

Effects: Computes z=y+Ax.

13

#

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

14

#

Remarks: z may alias y.