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

52 KiB
Raw Blame History

[linalg.algs.blas2]

29 Numerics library [numerics]

29.9 Basic linear algebra algorithms [linalg]

29.9.14 BLAS 2 algorithms [linalg.algs.blas2]

29.9.14.1 General matrix-vector product [linalg.algs.blas2.gemv]

1

#

[Note 1:

These functions correspond to the BLAS function xGEMV.

— end note]

2

#

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

3

#

Mandates:

possibly-multipliable<decltype(A), decltype(x), decltype(y)>() is true, and

possibly-addable<decltype(x), decltype(y), decltype(z)>() is true for those overloads that take a z parameter.

4

#

Preconditions:

multipliable(A,x,y) is true, and

addable(x,y,z) is true for those overloads that take a z parameter.

5

#

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, [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 matrix_vector_product(InMat A, InVec x, OutVec y); template<class ExecutionPolicy, [in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, [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 matrix_vector_product(ExecutionPolicy&& exec, InMat A, InVec x, OutVec y);

6

#

These functions perform an overwriting matrix-vector product.

7

#

Effects: Computes y=Ax.

[Example 1: constexpr size_t num_rows = 5;constexpr size_t num_cols = 6;

// y = 3.0 * A * xvoid scaled_matvec_1(mdspan<double, extents<size_t, num_rows, num_cols>> A, mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) { matrix_vector_product(scaled(3.0, A), x, y);}// z = 7.0 times the transpose of A, times yvoid scaled_transposed_matvec(mdspan<double, extents<size_t, num_rows, num_cols>> A, mdspan<double, extents<size_t, num_rows>> y, mdspan<double, extents<size_t, num_cols>> z) { matrix_vector_product(scaled(7.0, transposed(A)), y, z);} — end example]

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, [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 matrix_vector_product(InMat A, 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, [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 matrix_vector_product(ExecutionPolicy&& exec, InMat A, InVec1 x, InVec2 y, OutVec z);

8

#

These functions perform an updating matrix-vector product.

9

#

Effects: Computes z=y+Ax.

10

#

Remarks: z may alias y.

[Example 2: // y = 3.0 * A * x + 2.0 * yvoid scaled_matvec_2(mdspan<double, extents<size_t, num_rows, num_cols>> A, mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) { matrix_vector_product(scaled(3.0, A), x, scaled(2.0, y), y);} — end example]

29.9.14.2 Symmetric matrix-vector product [linalg.algs.blas2.symv]

1

#

[Note 1:

These functions correspond to the BLAS functionsxSYMV and xSPMV[bib].

— end note]

2

#

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

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;

possibly-multipliable<decltype(A), decltype(x), decltype(y)>() is true; and

possibly-addable<decltype(x), decltype(y), decltype(z)>() is true for those overloads that take a z parameter.

4

#

Preconditions:

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

multipliable(A,x,y) is true, and

addable(x,y,z) is true for those overloads that take a z parameter.

5

#

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, [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 symmetric_matrix_vector_product(InMat A, Triangle t, 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, [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 symmetric_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, InVec x, OutVec y);

6

#

These functions perform an overwriting symmetric matrix-vector product, taking into account the Triangle parameter that applies to the symmetric matrix A ([linalg.general]).

7

#

Effects: Computes y=Ax.

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, [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 symmetric_matrix_vector_product(InMat A, Triangle t, 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, [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 symmetric_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, InVec1 x, InVec2 y, OutVec z);

8

#

These functions perform an updating symmetric matrix-vector product, taking into account the Triangle parameter that applies to the symmetric matrix A ([linalg.general]).

9

#

Effects: Computes z=y+Ax.

10

#

Remarks: z may alias y.

29.9.14.3 Hermitian matrix-vector product [linalg.algs.blas2.hemv]

1

#

[Note 1:

These functions correspond to the BLAS functionsxHEMV and xHPMV[bib].

— end note]

2

#

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

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;

possibly-multipliable<decltype(A), decltype(x), decltype(y)>() is true; and

possibly-addable<decltype(x), decltype(y), decltype(z)>() is true for those overloads that take a z parameter.

4

#

Preconditions:

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

multipliable(A, x, y) is true, and

addable(x, y, z) is true for those overloads that take a z parameter.

5

#

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, [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 hermitian_matrix_vector_product(InMat A, Triangle t, 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, [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 hermitian_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, InVec x, OutVec y);

6

#

These functions perform an overwriting Hermitian matrix-vector product, taking into account the Triangle parameter that applies to the Hermitian matrix A ([linalg.general]).

7

#

Effects: Computes y=Ax.

🔗

template<[in-matrix](linalg.helpers.concepts#concept:in-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InMat, class Triangle, [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 hermitian_matrix_vector_product(InMat A, Triangle t, 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, [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 hermitian_matrix_vector_product(ExecutionPolicy&& exec, InMat A, Triangle t, InVec1 x, InVec2 y, OutVec z);

8

#

These functions perform an updating Hermitian matrix-vector product, taking into account the Triangle parameter that applies to the Hermitian matrix A ([linalg.general]).

9

#

Effects: Computes z=y+Ax.

10

#

Remarks: z may alias y.

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.

29.9.14.5 Solve a triangular linear system [linalg.algs.blas2.trsv]

1

#

[Note 1:

These functions correspond to the BLAS functionsxTRSV and xTPSV[bib].

— end note]

2

#

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

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(b)>(0, 0) is true; and

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

4

#

Preconditions:

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

A.extent(0) equals b.extent(0), and

A.extent(0) equals x.extent(0) for those overloads that take an x 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, class BinaryDivideOp> void triangular_matrix_vector_solve(InMat A, Triangle t, DiagonalStorage d, InVec b, OutVec x, 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, [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, class BinaryDivideOp> void triangular_matrix_vector_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InVec b, OutVec x, BinaryDivideOp divide);

5

#

These functions perform a triangular solve, taking into account the Triangle and DiagonalStorage parameters that apply to the triangular matrix A ([linalg.general]).

6

#

Effects: Computes a vector x′ such that b=Ax′, and assigns each element of x′ to the corresponding element of x.

If no such x′ exists, then the elements of x are valid but unspecified.

7

#

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

🔗

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_solve(InMat A, Triangle t, DiagonalStorage d, InVec b, OutVec x);

8

#

Effects: Equivalent to:triangular_matrix_vector_solve(A, t, d, b, x, 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, [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_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InVec b, OutVec x);

9

#

Effects: Equivalent to:triangular_matrix_vector_solve(std::forward(exec), A, t, d, b, x, divides{});

🔗

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, class BinaryDivideOp> void triangular_matrix_vector_solve(InMat A, Triangle t, DiagonalStorage d, InOutVec 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-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec, class BinaryDivideOp> void triangular_matrix_vector_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutVec b, BinaryDivideOp divide);

10

#

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

[Note 2:

Performing triangular solve in place hinders parallelization.

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

— end note]

11

#

Effects: Computes a vector x′ such that b=Ax′, and assigns each element of x′ to the corresponding element of b.

If no such x′ exists, then the elements of b are valid but unspecified.

12

#

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

🔗

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_solve(InMat A, Triangle t, DiagonalStorage d, InOutVec b);

13

#

Effects: Equivalent to:triangular_matrix_vector_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-vector](linalg.helpers.concepts#concept:inout-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutVec> void triangular_matrix_vector_solve(ExecutionPolicy&& exec, InMat A, Triangle t, DiagonalStorage d, InOutVec b);

14

#

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

29.9.14.6 Rank-1 (outer product) update of a matrix [linalg.algs.blas2.rank1]

🔗

template<[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, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void matrix_rank_1_update(InVec1 x, InVec2 y, InOutMat A); template<class ExecutionPolicy, [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, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void matrix_rank_1_update(ExecutionPolicy&& exec, InVec1 x, InVec2 y, InOutMat A);

1

#

These functions perform a nonsymmetric nonconjugated rank-1 update.

[Note 1:

These functions correspond to the BLAS functionsxGER (for real element types) andxGERU (for complex element types)[bib].

— end note]

2

#

Mandates: possibly-multipliable<InOutMat, InVec2, InVec1>() is true.

3

#

Preconditions: multipliable(A, y, x) is true.

4

#

Effects: Computes a matrix A′ such that A′=A+xyT, and assigns each element of A′ to the corresponding element of A.

5

#

Complexity: O(x.extent(0)×y.extent(0)).

🔗

template<[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, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void matrix_rank_1_update_c(InVec1 x, InVec2 y, InOutMat A); template<class ExecutionPolicy, [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, [inout-matrix](linalg.helpers.concepts#concept:inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat> void matrix_rank_1_update_c(ExecutionPolicy&& exec, InVec1 x, InVec2 y, InOutMat A);

6

#

These functions perform a nonsymmetric conjugated rank-1 update.

[Note 2:

These functions correspond to the BLAS functionsxGER (for real element types) andxGERC (for complex element types)[bib].

— end note]

7

#

Effects:

For the overloads without an ExecutionPolicy argument, equivalent to:matrix_rank_1_update(x, conjugated(y), A);

otherwise, equivalent to:matrix_rank_1_update(std::forward(exec), x, conjugated(y), A);

29.9.14.7 Symmetric or Hermitian Rank-1 (outer product) update of a matrix [linalg.algs.blas2.symherrank1]

1

#

[Note 1:

These functions correspond to the BLAS functionsxSYR, xSPR, xHER, and xHPR[bib].

They have overloads taking a scaling factor alpha, because it would be impossible to express the updateA=A−xxT otherwise.

— end note]

2

#

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

3

#

Mandates:

If InOutMat 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; and

compatible-static-extents<decltype(A), decltype(x)>(0, 0) is true.

4

#

Preconditions:

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

A.extent(0) equals x.extent(0).

5

#

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

🔗

template<class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A, Triangle t); template<class ExecutionPolicy, class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec, Scalar alpha, InVec x, InOutMat A, Triangle t);

6

#

These functions perform a symmetric rank-1 update of the symmetric matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

7

#

Effects: Computes a matrix A′ such thatA′=A+αxxT, where the scalar α is alpha, and assigns each element of A′ to the corresponding element of A.

🔗

template<[in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_1_update(InVec x, InOutMat A, Triangle t); template<class ExecutionPolicy, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t);

8

#

These functions perform a symmetric rank-1 update of the symmetric matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

9

#

Effects: Computes a matrix A′ such that A′=A+xxT and assigns each element of A′ to the corresponding element of A.

🔗

template<class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A, Triangle t); template<class ExecutionPolicy, class Scalar, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec, Scalar alpha, InVec x, InOutMat A, Triangle t);

10

#

These functions perform a Hermitian rank-1 update of the Hermitian matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

11

#

Effects: Computes A′ such thatA′=A+αxxH, where the scalar α is alpha, and assigns each element of A′ to the corresponding element of A.

🔗

template<[in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_1_update(InVec x, InOutMat A, Triangle t); template<class ExecutionPolicy, [in-vector](linalg.helpers.concepts#concept:in-vector "29.9.7.5Argument concepts[linalg.helpers.concepts]") InVec, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t);

12

#

These functions perform a Hermitian rank-1 update of the Hermitian matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

13

#

Effects: Computes a matrix A′ such that A′=A+xxH and assigns each element of A′ to the corresponding element of A.

29.9.14.8 Symmetric and Hermitian rank-2 matrix updates [linalg.algs.blas2.rank2]

1

#

[Note 1:

These functions correspond to the BLAS functionsxSYR2,xSPR2, xHER2 and xHPR2[bib].

— end note]

2

#

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

3

#

Mandates:

If InOutMat 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; and

possibly-multipliable<decltype(A), decltype(x), decltype(y)>() is true.

4

#

Preconditions:

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

multipliable(A, x, y) is true.

5

#

Complexity: O(x.extent(0)×y.extent(0)).

🔗

template<[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, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_2_update(InVec1 x, InVec2 y, InOutMat A, Triangle t); template<class ExecutionPolicy, [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, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void symmetric_matrix_rank_2_update(ExecutionPolicy&& exec, InVec1 x, InVec2 y, InOutMat A, Triangle t);

6

#

These functions perform a symmetric rank-2 update of the symmetric matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

7

#

Effects: Computes A′ such that A′=A+xyT+yxT and assigns each element of A′ to the corresponding element of A.

🔗

template<[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, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_2_update(InVec1 x, InVec2 y, InOutMat A, Triangle t); template<class ExecutionPolicy, [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, [possibly-packed-inout-matrix](linalg.helpers.concepts#concept:possibly-packed-inout-matrix "29.9.7.5Argument concepts[linalg.helpers.concepts]") InOutMat, class Triangle> void hermitian_matrix_rank_2_update(ExecutionPolicy&& exec, InVec1 x, InVec2 y, InOutMat A, Triangle t);

8

#

These functions perform a Hermitian rank-2 update of the Hermitian matrix A, taking into account the Triangle parameter that applies to A ([linalg.general]).

9

#

Effects: Computes A′ such that A′=A+xyH+yxH and assigns each element of A′ to the corresponding element of A.