标准库标头 <linalg> (C++26)

来自cppreference.com
< cpp‎ | header


 
 
标准库标头
语言支持
概念
<concepts> (C++20)
诊断
<system_error> (C++11)

内存管理
<memory_resource> (C++17)  
元编程
<type_traits> (C++11)
<ratio> (C++11)
通用工具
<utility>
<tuple> (C++11)
<optional> (C++17)
<variant> (C++17)
<any> (C++17)
<debugging> (C++26)
<expected> (C++23)
<bitset>
<charconv> (C++17)
<format> (C++20)
<bit> (C++20)

字符串
<cuchar> (C++11)

容器
<flat_set> (C++23)
<span> (C++20)
<mdspan> (C++23)
<inplace_vector> (C++26)
迭代器
<iterator>
范围
<ranges> (C++20)
<generator> (C++23)
算法
数值
<cfenv> (C++11)
<complex>
<cmath>
<linalg> (C++26)
<numbers> (C++20)

日期时间
<chrono> (C++11)
本地化
<codecvt> (C++11/17/26*)
<text_encoding> (C++26)
输入/输出
<filesystem> (C++17)
<cstdio>
<cinttypes> (C++11)
<strstream> (C++98/26*)
正则表达式
<regex> (C++11)
并发支持
<stop_token> (C++20)
<thread> (C++11)
<atomic> (C++11)
<rcu> (C++26)
<stdatomic.h> (C++23)
<mutex> (C++11)
<shared_mutex> (C++14)

<condition_variable> (C++11)  
<semaphore> (C++20)
<latch> (C++20)

<barrier> (C++20)
<future> (C++11)
<hazard_pointer> (C++26)

C 兼容
<cstdbool> (C++11/17/20*)  
<ccomplex> (C++11/17/20*)
<ctgmath> (C++11/17/20*)

<cstdalign> (C++11/17/20*)

<ciso646> (C++20 前)

 

此头文件是数值库的一部分。

在命名空间 std::linalg 定义
std::mdspan 布局映射策略,表示仅存储一个三角形中的各项的方阵,以打包连续格式存储
(类模板)
std::mdspan 访问器策略,其引用表示一个固定缩放因数和其嵌套 std::mdspan 访问器的引用的乘积
(类模板)
std::mdspan 访问器策略,其引用代表的是其嵌套 std::mdspan 访问器的引用的复共轭
(类模板)
std::mdspan 布局映射策略,交换任意唯一布局映射策略的最右侧两套索引、尺度和步长
(类模板)

标签

在命名空间 std::linalg 定义
描述具有 linalg::layout_blas_packed 布局的 std::mdspan 的元素顺序
(标签)
指定算法和矩阵的其他使用方应当访问矩阵的上三角还是下三角
(标签)
指定算法是否应当访问矩阵的对角线项
(标签)

函数

在命名空间 std::linalg 定义
原位变换
(C++26)
返回新的只读 std::mdspan,逐元素计算缩放因子和给定 std::mdspan 的相应元素的乘积
(函数模板)
返回新的只读 std::mdspan,其各元素为给定 std::mdspan 对象的对应元素的复共轭
(函数模板)
返回表示给定 std::mdspan 的输入矩阵的转置的新 std::mdspan
(函数模板)
返回对象的共轭转置视图
(函数模板)
BLAS 1 函数
产生平面旋转
(函数模板)
将平面旋转应用于向量
(函数模板)
交换矩阵或向量的全部对应元素
(函数模板)
(C++26)
以计算矩阵或向量和一个标量的逐元素相乘的结果对它覆写
(函数模板)
(C++26)
将一个矩阵或向量的各元素复制给另一个
(函数模板)
(C++26)
按元素添加向量或矩阵
(函数模板)
(C++26)
返回两个向量的非共轭点积
(函数模板)
(C++26)
返回两个向量的共轭点积
(函数模板)
返回缩放的向量各元素平方和
(函数模板)
返回向量的欧氏范数
(函数模板)
返回向量各元素绝对值的和
(函数模板)
返回向量各元素最大绝对值的索引
(函数模板)
返回矩阵的弗罗贝尼乌斯范数
(函数模板)
返回矩阵的 1-范数
(函数模板)
返回矩阵的 ∞-范数
(函数模板)
BLAS 2 函数
计算矩阵-向量乘积
(函数模板)
计算对称矩阵-向量乘积
(函数模板)
计算厄米特矩阵-向量乘积
(函数模板)
计算三角矩阵-向量乘积
(函数模板)
求解三角线性系统
(函数模板)
实施矩阵的非对称非共轭秩-1 更新
(函数模板)
实施矩阵的非对称共轭秩-1 更新
(函数模板)
实施对称矩阵的秩-1 更新
(函数模板)
实施厄米特矩阵的秩-1 更新
(函数模板)
实施对称矩阵的秩-2 更新
(函数模板)
实施厄米特矩阵的秩-2 更新
(函数模板)
BLAS 3 函数
计算矩阵-矩阵乘积
(函数模板)
计算对称矩阵-矩阵乘积
(函数模板)
计算厄米特矩阵-矩阵乘积
(函数模板)
计算三角矩阵-矩阵乘积
(函数模板)
实施对称矩阵的秩-k 更新
(函数模板)
实施厄米特矩阵的秩-k 更新
(函数模板)
实施对称矩阵的秩-2k 更新
(函数模板)
实施厄米特矩阵的秩-2k 更新
(函数模板)
求解多重三角线性系统
(函数模板)

概要

namespace std::linalg {
 
// 存储顺序标签
struct column_major_t;
inline constexpr column_major_t column_major;
struct row_major_t;
inline constexpr row_major_t row_major;
 
// 三角形标签
struct upper_triangle_t;
inline constexpr upper_triangle_t upper_triangle;
struct lower_triangle_t;
inline constexpr lower_triangle_t lower_triangle;
 
// 对角线标签
struct implicit_unit_diagonal_t;
inline constexpr implicit_unit_diagonal_t implicit_unit_diagonal;
struct explicit_diagonal_t;
inline constexpr explicit_diagonal_t explicit_diagonal;
 
// 类模板 layout_blas_packed
template<class Triangle, class StorageOrder>
class layout_blas_packed;
 
// 仅用于阐释的概念和特征
template<class T>
struct __is_mdspan; // 仅用于阐释
 
template<class T>
concept __in_vector = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __out_vector = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __inout_vector = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __in_matrix = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __out_matrix = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __inout_matrix = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __possibly_packed_inout_matrix = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __in_object = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __out_object = /* 见描述 */; // 仅用于阐释
 
template<class T>
concept __inout_object = /* 见描述 */; // 仅用于阐释
 
// 缩放原位变换
template<class ScalingFactor, class Accessor>
class scaled_accessor;
 
template<class ScalingFactor,
         class ElementType, class Extents, class Layout, class Accessor>
constexpr auto scaled(ScalingFactor scaling_factor,
                      mdspan<ElementType, Extents, Layout, Accessor> x);
 
// 共轭原位变换
template<class Accessor>
class conjugated_accessor;
 
template<class ElementType, class Extents, class Layout, class Accessor>
constexpr auto conjugated(mdspan<ElementType, Extents, Layout, Accessor> a);
 
// 转置原位变换
template<class Layout>
class layout_transpose;
 
template<class ElementType, class Extents, class Layout, class Accessor>
constexpr auto transposed(mdspan<ElementType, Extents, Layout, Accessor> a);
 
// 共轭转置原位变换
template<class ElementType, class Extents, class Layout, class Accessor>
constexpr auto conjugate_transposed(mdspan<ElementType, Extents, Layout, Accessor> a);
 
// 算法
// 计算 Givens 旋转
 
template<class Real>
struct setup_givens_rotation_result {
  Real c;
  Real s;
  Real r;
};
 
template<class Real>
struct setup_givens_rotation_result<complex<Real>> {
  Real c;
  complex<Real> s;
  complex<Real> r;
};
 
template<class Real>
setup_givens_rotation_result<Real> setup_givens_rotation(Real a, Real b) noexcept;
 
template<class Real>
setup_givens_rotation_result<complex<Real>>
setup_givens_rotation(complex<Real> a, complex<Real> b) noexcept;
 
// 运用计算的 Givens 旋转
template<__inout_vector InOutVec1, __inout_vector InOutVec2, class Real>
void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, Real s);
 
template<class ExecutionPolicy,
         __inout_vector InOutVec1, __inout_vector InOutVec2, class Real>
void apply_givens_rotation(ExecutionPolicy&& exec,
                           InOutVec1 x, InOutVec2 y, Real c, Real s);
 
template<__inout_vector InOutVec1, __inout_vector InOutVec2, class Real>
void apply_givens_rotation(InOutVec1 x, InOutVec2 y, Real c, complex<Real> s);
 
template<class ExecutionPolicy,
         __inout_vector InOutVec1, __inout_vector InOutVec2, class Real>
void apply_givens_rotation(ExecutionPolicy&& exec,
                           InOutVec1 x, InOutVec2 y, Real c, complex<Real> s);
 
// 交换元素
template<__inout_object InOutObj1, __inout_object InOutObj2>
void swap_elements(InOutObj1 x, InOutObj2 y);
 
template<class ExecutionPolicy, __inout_object InOutObj1, __inout_object InOutObj2>
void swap_elements(ExecutionPolicy&& exec, InOutObj1 x, InOutObj2 y);
 
// 各元素乘以缩放比例
template<class Scalar, __inout_object InOutObj>
void scale(Scalar alpha, InOutObj x);
 
template<class ExecutionPolicy, class Scalar, __inout_object InOutObj>
void scale(ExecutionPolicy&& exec, Scalar alpha, InOutObj x);
 
// 复制元素
template<__in_object InObj, __out_object OutObj>
void copy(InObj x, OutObj y);
 
template<class ExecutionPolicy, __in_object InObj, __out_object OutObj>
void copy(ExecutionPolicy&& exec, InObj x, OutObj y);
 
// 逐元素加
template<__in_object InObj1, __in_object InObj2, __out_object OutObj>
void add(InObj1 x, InObj2 y, OutObj z);
 
template<class ExecutionPolicy,
         __in_object InObj1, __in_object InObj2, __out_object OutObj>
void add(ExecutionPolicy&& exec, InObj1 x, InObj2 y, OutObj z);
 
// 两个向量的非共轭点积
template<__in_vector InVec1, __in_vector InVec2, class Scalar>
Scalar dot(InVec1 v1, InVec2 v2, Scalar init);
 
template<class ExecutionPolicy,
         __in_vector InVec1, __in_vector InVec2, class Scalar>
Scalar dot(ExecutionPolicy&& exec, InVec1 v1, InVec2 v2, Scalar init);
 
template<__in_vector InVec1, __in_vector InVec2>
auto dot(InVec1 v1, InVec2 v2) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_vector InVec1, __in_vector InVec2>
auto dot(ExecutionPolicy&& exec, InVec1 v1, InVec2 v2) -> /* 见描述 */;
 
// 两个向量的共轭点积
template<__in_vector InVec1, __in_vector InVec2, class Scalar>
Scalar dotc(InVec1 v1, InVec2 v2, Scalar init);
 
template<class ExecutionPolicy,
         __in_vector InVec1, __in_vector InVec2, class Scalar>
Scalar dotc(ExecutionPolicy&& exec, InVec1 v1, InVec2 v2, Scalar init);
 
template<__in_vector InVec1, __in_vector InVec2>
auto dotc(InVec1 v1, InVec2 v2) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_vector InVec1, __in_vector InVec2>
auto dotc(ExecutionPolicy&& exec, InVec1 v1, InVec2 v2) -> /* 见描述 */;
 
// 向量各元素的缩放平方和
template<class Scalar>
struct sum_of_squares_result {
  Scalar scaling_factor;
  Scalar scaled_sum_of_squares;
};
 
template<__in_vector InVec, class Scalar>
sum_of_squares_result<Scalar>
vector_sum_of_squares(InVec v, sum_of_squares_result<Scalar> init);
 
template<class ExecutionPolicy, __in_vector InVec, class Scalar>
sum_of_squares_result<Scalar>
vector_sum_of_squares(ExecutionPolicy&& exec, InVec v,
                      sum_of_squares_result<Scalar> init);
 
// 向量的欧式范数
template<__in_vector InVec, class Scalar>
Scalar vector_two_norm(InVec v, Scalar init);
 
template<class ExecutionPolicy, __in_vector InVec, class Scalar>
Scalar vector_two_norm(ExecutionPolicy&& exec, InVec v, Scalar init);
 
template<__in_vector InVec>
auto vector_two_norm(InVec v) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_vector InVec>
auto vector_two_norm(ExecutionPolicy&& exec, InVec v) -> /* 见描述 */;
 
// 向量各元素的绝对值和
template<__in_vector InVec, class Scalar>
Scalar vector_abs_sum(InVec v, Scalar init);
template<class ExecutionPolicy, __in_vector InVec, class Scalar>
Scalar vector_abs_sum(ExecutionPolicy&& exec, InVec v, Scalar init);
 
template<__in_vector InVec>
auto vector_abs_sum(InVec v) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_vector InVec>
auto vector_abs_sum(ExecutionPolicy&& exec, InVec v) -> /* 见描述 */;
 
// 向量各元素最大绝对值的索引
template<__in_vector InVec>
typename InVec::extents_type idx_abs_max(InVec v);
 
template<class ExecutionPolicy, __in_vector InVec>
typename InVec::extents_type idx_abs_max(ExecutionPolicy&& exec, InVec v);
 
// 矩阵的弗罗贝尼乌斯范数
template<__in_matrix InMat, class Scalar>
Scalar matrix_frob_norm(InMat A, Scalar init);
 
template<class ExecutionPolicy, __in_matrix InMat, class Scalar>
Scalar matrix_frob_norm(ExecutionPolicy&& exec,
                        InMat A, Scalar init);
 
template<__in_matrix InMat>
auto matrix_frob_norm(InMat A) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_matrix InMat>
auto matrix_frob_norm(ExecutionPolicy&& exec, InMat A) -> /* 见描述 */;
 
// 矩阵的 1-范数
template<__in_matrix InMat, class Scalar>
Scalar matrix_one_norm(InMat A, Scalar init);
 
template<class ExecutionPolicy, __in_matrix InMat, class Scalar>
Scalar matrix_one_norm(ExecutionPolicy&& exec,
                       InMat A, Scalar init);
 
template<__in_matrix InMat>
auto matrix_one_norm(InMat A) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_matrix InMat>
auto matrix_one_norm(ExecutionPolicy&& exec, InMat A) -> /* 见描述 */;
 
// 矩阵的 ∞-范数
template<__in_matrix InMat, class Scalar>
Scalar matrix_inf_norm(InMat A, Scalar init);
 
template<class ExecutionPolicy, __in_matrix InMat, class Scalar>
Scalar matrix_inf_norm(ExecutionPolicy&& exec,
                       InMat A, Scalar init);
 
template<__in_matrix InMat>
auto matrix_inf_norm(InMat A) -> /* 见描述 */;
 
template<class ExecutionPolicy, __in_matrix InMat>
auto matrix_inf_norm(ExecutionPolicy&& exec, InMat A) -> /* 见描述 */;
 
// 通用矩阵与向量乘积
template<__in_matrix InMat, __in_vector InVec, __out_vector OutVec>
void matrix_vector_product(InMat A, InVec x, OutVec y);
 
template<class ExecutionPolicy,
         __in_matrix InMat, __in_vector InVec, __out_vector OutVec>
void matrix_vector_product(ExecutionPolicy&& exec,
                           InMat A, InVec x, OutVec y);
 
template<__in_matrix InMat, __in_vector InVec1,
         __in_vector InVec2, __out_vector OutVec>
void matrix_vector_product(InMat A, InVec1 x, InVec2 y, OutVec z);
 
template<class ExecutionPolicy,
         __in_matrix InMat, __in_vector InVec1,
         __in_vector InVec2, __out_vector OutVec>
void matrix_vector_product(ExecutionPolicy&& exec,
                           InMat A, InVec1 x, InVec2 y, OutVec z);
 
// 对称矩阵与向量乘积
template<__in_matrix InMat, class Triangle,
         __in_vector InVec, __out_vector OutVec>
void symmetric_matrix_vector_product(InMat A, Triangle t,
                                     InVec x, OutVec y);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle,
         __in_vector InVec, __out_vector OutVec>
void symmetric_matrix_vector_product(ExecutionPolicy&& exec,
                                     InMat A, Triangle t,
                                     InVec x, OutVec y);
 
template<__in_matrix InMat, class Triangle,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void symmetric_matrix_vector_product(InMat A, Triangle t,
                                     InVec1 x, InVec2 y, OutVec z);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void symmetric_matrix_vector_product(ExecutionPolicy&& exec,
                                     InMat A, Triangle t,
                                     InVec1 x, InVec2 y, OutVec z);
 
// 厄米特矩阵与向量乘积
template<__in_matrix InMat, class Triangle,
         __in_vector InVec, __out_vector OutVec>
void hermitian_matrix_vector_product(InMat A, Triangle t,
                                     InVec x, OutVec y);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle,
         __in_vector InVec, __out_vector OutVec>
void hermitian_matrix_vector_product(ExecutionPolicy&& exec,
                                     InMat A, Triangle t,
                                     InVec x, OutVec y);
 
template<__in_matrix InMat, class Triangle,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void hermitian_matrix_vector_product(InMat A, Triangle t,
                                     InVec1 x, InVec2 y, OutVec z);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void hermitian_matrix_vector_product(ExecutionPolicy&& exec,
                                     InMat A, Triangle t,
                                     InVec1 x, InVec2 y, OutVec z);
 
// 三角形矩阵与向量乘积
// 覆写三角形矩阵与向量乘积
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector OutVec>
void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d,
                                      InVec x, OutVec y);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector OutVec>
void triangular_matrix_vector_product(ExecutionPolicy&& exec,
                                      InMat A, Triangle t, DiagonalStorage d,
                                      InVec x, OutVec y);
 
// 原位三角形矩阵与向量乘积
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec>
void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d,
                                      InOutVec y);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec>
void triangular_matrix_vector_product(ExecutionPolicy&& exec,
                                      InMat A, Triangle t, DiagonalStorage d,
                                      InOutVec y);
 
// 更新三角形矩阵与向量乘积
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void triangular_matrix_vector_product(InMat A, Triangle t, DiagonalStorage d,
                                      InVec1 x, InVec2 y, OutVec z);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec1, __in_vector InVec2,
         __out_vector OutVec>
void triangular_matrix_vector_product(ExecutionPolicy&& exec,
                                      InMat A, Triangle t, DiagonalStorage d,
                                      InVec1 x, InVec2 y, OutVec z);
 
// 非原位,求解三角形线性系统
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector 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 InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector OutVec, class BinaryDivideOp>
void triangular_matrix_vector_solve(ExecutionPolicy&& exec,
                                    InMat A, Triangle t, DiagonalStorage d,
                                    InVec b, OutVec x, BinaryDivideOp divide);
 
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector OutVec>
void triangular_matrix_vector_solve(InMat A, Triangle t, DiagonalStorage d,
                                    InVec b, OutVec x);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __in_vector InVec, __out_vector OutVec>
void triangular_matrix_vector_solve(ExecutionPolicy&& exec,
                                    InMat A, Triangle t, DiagonalStorage d,
                                    InVec b, OutVec x);
 
// 原位,求解三角形线性系统
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec, class BinaryDivideOp>
void triangular_matrix_vector_solve(InMat A, Triangle t, DiagonalStorage d,
                                    InOutVec b, BinaryDivideOp divide);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec, class BinaryDivideOp>
void triangular_matrix_vector_solve(ExecutionPolicy&& exec,
                                    InMat A, Triangle t, DiagonalStorage d,
                                    InOutVec b, BinaryDivideOp divide);
 
template<__in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec>
void triangular_matrix_vector_solve(InMat A, Triangle t, DiagonalStorage d,
                                    InOutVec b);
 
template<class ExecutionPolicy,
         __in_matrix InMat, class Triangle, class DiagonalStorage,
         __inout_vector InOutVec>
void triangular_matrix_vector_solve(ExecutionPolicy&& exec,
                                    InMat A, Triangle t, DiagonalStorage d,
                                    InOutVec b);
 
// 非共轭的秩-1 矩阵更新
template<__in_vector InVec1, __in_vector InVec2, __inout_matrix InOutMat>
void matrix_rank_1_update(InVec1 x, InVec2 y, InOutMat A);
 
template<class ExecutionPolicy,
         __in_vector InVec1, __in_vector InVec2, __inout_matrix InOutMat>
void matrix_rank_1_update(ExecutionPolicy&& exec,
                          InVec1 x, InVec2 y, InOutMat A);
 
// 共轭的秩-1 矩阵更新
template<__in_vector InVec1, __in_vector InVec2, __inout_matrix InOutMat>
void matrix_rank_1_update_c(InVec1 x, InVec2 y, InOutMat A);
 
template<class ExecutionPolicy, 
         __in_vector InVec1, __in_vector InVec2, __inout_matrix InOutMat>
void matrix_rank_1_update_c(ExecutionPolicy&& exec,
                            InVec1 x, InVec2 y, InOutMat A);
 
// 对称的秩-1 矩阵更新
template<__in_vector InVec, __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void symmetric_matrix_rank_1_update(InVec x, InOutMat A, Triangle t);
 
template<class ExecutionPolicy,
         __in_vector InVec, __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec,
                                    InVec x, InOutMat A, Triangle t);
 
template<class Scalar, __in_vector InVec,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A,
                                    Triangle t);
 
template<class ExecutionPolicy,
         class Scalar, __in_vector InVec,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec,
                                    Scalar alpha, InVec x, InOutMat A,
                                    Triangle t);
 
// 厄米特秩-1 矩阵更新
template<__in_vector InVec, __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_1_update(InVec x, InOutMat A, Triangle t);
 
template<class ExecutionPolicy,
         __in_vector InVec, __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec,
                                    InVec x, InOutMat A, Triangle t);
 
template<class Scalar, __in_vector InVec,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_1_update(Scalar alpha, InVec x, InOutMat A,
                                    Triangle t);
 
template<class ExecutionPolicy,
         class Scalar, __in_vector InVec,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec,
                                    Scalar alpha, InVec x, InOutMat A,
                                    Triangle t);
 
// 对称的秩-2 矩阵更新
template<__in_vector InVec1, __in_vector InVec2,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void symmetric_matrix_rank_2_update(InVec1 x, InVec2 y, InOutMat A,
                                    Triangle t);
 
template<class ExecutionPolicy,
         __in_vector InVec1, __in_vector InVec2,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void symmetric_matrix_rank_2_update(ExecutionPolicy&& exec,
                                    InVec1 x, InVec2 y, InOutMat A,
                                    Triangle t);
 
// 厄米特秩-2 矩阵更新
template<__in_vector InVec1, __in_vector InVec2,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_2_update(InVec1 x, InVec2 y, InOutMat A,
                                    Triangle t);
 
template<class ExecutionPolicy,
         __in_vector InVec1, __in_vector InVec2,
         __possibly_packed_inout_matrix InOutMat,
         class Triangle>
void hermitian_matrix_rank_2_update(ExecutionPolicy&& exec,
                                    InVec1 x, InVec2 y, InOutMat A,
                                    Triangle t);
 
// 通用矩阵与矩阵乘积
template<__in_matrix InMat1, __in_matrix InMat2, __out_matrix OutMat>
void matrix_product(InMat1 A, InMat2 B, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2, __out_matrix OutMat>
void matrix_product(ExecutionPolicy&& exec, InMat1 A, InMat2 B, OutMat C);
 
template<__in_matrix InMat1, __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void matrix_product(InMat1 A, InMat2 B, InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void matrix_product(ExecutionPolicy&& exec,
                    InMat1 A, InMat2 B, InMat3 E, OutMat C);
 
 
// 对称矩阵与矩阵乘积
// 覆写对称矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __out_matrix OutMat>
void symmetric_matrix_product(InMat1 A, Triangle t,
                              InMat2 B, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __out_matrix OutMat>
void symmetric_matrix_product(ExecutionPolicy&& exec,
                              InMat1 A, Triangle t,
                              InMat2 B, OutMat C);
 
// 覆写对称矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2,
         class Triangle, __out_matrix OutMat>
void symmetric_matrix_product(InMat1 B, InMat2 A, Triangle t,
                              OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         class Triangle, __out_matrix OutMat>
void symmetric_matrix_product(ExecutionPolicy&& exec,
                              InMat1 B, InMat2 A, Triangle t,
                              OutMat C);
 
// 更新对称矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void symmetric_matrix_product(InMat1 A, Triangle t,
                              InMat2 B, InMat3 E,
                              OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void symmetric_matrix_product(ExecutionPolicy&& exec,
                              InMat1 A, Triangle t,
                              InMat2 B, InMat3 E,
                              OutMat C);
 
// 更新对称矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2, class Triangle,
         __in_matrix InMat3, __out_matrix OutMat>
void symmetric_matrix_product(InMat1 B, InMat2 A, Triangle t,
                              InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2, class Triangle,
         __in_matrix InMat3, __out_matrix OutMat>
void symmetric_matrix_product(ExecutionPolicy&& exec,
                              InMat1 B, InMat2 A, Triangle t,
                              InMat3 E, OutMat C);
 
// 厄米特矩阵与矩阵乘积
// 覆写厄米特矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __out_matrix OutMat>
void hermitian_matrix_product(InMat1 A, Triangle t,
                              InMat2 B, OutMat C);
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __out_matrix OutMat>
void hermitian_matrix_product(ExecutionPolicy&& exec,
                              InMat1 A, Triangle t,
                              InMat2 B, OutMat C);
 
// 覆写厄米特矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2,
         class Triangle, __out_matrix OutMat>
void hermitian_matrix_product(InMat1 B, InMat2 A, Triangle t,
                              OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         class Triangle, __out_matrix OutMat>
void hermitian_matrix_product(ExecutionPolicy&& exec,
                              InMat1 B, InMat2 A, Triangle t,
                              OutMat C);
 
// 更新厄米特矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __in_matrix InMat3, __out_matrix OutMat>
void hermitian_matrix_product(InMat1 A, Triangle t,
                              InMat2 B, InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle,
         __in_matrix InMat2, __in_matrix InMat3, __out_matrix OutMat>
void hermitian_matrix_product(ExecutionPolicy&& exec,
                              InMat1 A, Triangle t,
                              InMat2 B, InMat3 E, OutMat C);
 
// 更新厄米特矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2, class Triangle,
         __in_matrix InMat3, __out_matrix OutMat>
void hermitian_matrix_product(InMat1 B, InMat2 A, Triangle t,
                              InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2, class Triangle,
         __in_matrix InMat3, __out_matrix OutMat>
void hermitian_matrix_product(ExecutionPolicy&& exec,
                              InMat1 B, InMat2 A, Triangle t,
                              InMat3 E, OutMat C);
 
// 三角形矩阵与矩阵乘积
// 覆写三角形矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_product(InMat1 A, Triangle t, DiagonalStorage d,
                               InMat2 B, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_product(ExecutionPolicy&& exec,
                               InMat1 A, Triangle t, DiagonalStorage d,
                               InMat2 B, OutMat C);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_left_product(InMat1 A, Triangle t, DiagonalStorage d,
                                    InOutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_left_product(ExecutionPolicy&& exec,
                                    InMat1 A, Triangle t, DiagonalStorage d,
                                    InOutMat C);
 
// 覆写三角形矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2,
         class Triangle, class DiagonalStorage,
         __out_matrix OutMat>
void triangular_matrix_product(InMat1 B, InMat2 A,
                               Triangle t, DiagonalStorage d,
                               OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         class Triangle, class DiagonalStorage,
         __out_matrix OutMat>
void triangular_matrix_product(ExecutionPolicy&& exec,
                               InMat1 B, InMat2 A,
                               Triangle t, DiagonalStorage d,
                               OutMat C);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_right_product(InMat1 A, Triangle t, DiagonalStorage d,
                                     InOutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_right_product(ExecutionPolicy&& exec,
                                     InMat1 A, Triangle t, DiagonalStorage d,
                                     InOutMat C);
 
// 更新三角形矩阵与矩阵左乘
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void triangular_matrix_product(InMat1 A, Triangle t, DiagonalStorage d,
                               InMat2 B, InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __in_matrix InMat3,
         __out_matrix OutMat>
void triangular_matrix_product(ExecutionPolicy&& exec,
                               InMat1 A, Triangle t, DiagonalStorage d,
                               InMat2 B, InMat3 E, OutMat C);
 
// 更新三角形矩阵与矩阵右乘
template<__in_matrix InMat1, __in_matrix InMat2,
         class Triangle, class DiagonalStorage,
         __in_matrix InMat3, __out_matrix OutMat>
void triangular_matrix_product(InMat1 B, InMat2 A,
                               Triangle t, DiagonalStorage d,
                               InMat3 E, OutMat C);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         class Triangle, class DiagonalStorage,
         __in_matrix InMat3, __out_matrix OutMat>
void triangular_matrix_product(ExecutionPolicy&& exec,
                               InMat1 B, InMat2 A,
                               Triangle t, DiagonalStorage d,
                               InMat3 E, OutMat C);
 
// 秩-k 对称矩阵更新
template<class Scalar, __in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_k_update(Scalar alpha, InMat1 A, InOutMat C,
                                    Triangle t);
 
template<class Scalar,
         class ExecutionPolicy,
         ___in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_k_update(ExecutionPolicy&& exec,
                                    Scalar alpha, InMat1 A, InOutMat C,
                                    Triangle t);
 
template<__in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_k_update(InMat1 A, InOutMat C, Triangle t);
 
template<class ExecutionPolicy,
         __in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_k_update(ExecutionPolicy&& exec,
                                    InMat1 A, InOutMat C, Triangle t);
 
// 秩-k 厄米特矩阵更新
template<class Scalar, __in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void hermitian_matrix_rank_k_update(Scalar alpha, InMat1 A, InOutMat C,
                                    Triangle t);
 
template<class ExecutionPolicy,
         class Scalar, __in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle
void hermitian_matrix_rank_k_update(ExecutionPolicy&& exec,
                                    Scalar alpha, InMat1 A, InOutMat C,
                                    Triangle t);
 
template<__in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void hermitian_matrix_rank_k_update(InMat1 A, InOutMat C, Triangle t);
 
template<class ExecutionPolicy,
         __in_matrix InMat1,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void hermitian_matrix_rank_k_update(ExecutionPolicy&& exec,
                                    InMat1 A, InOutMat C, Triangle t);
 
// 秩-2k 对称矩阵更新
template<__in_matrix InMat1, __in_matrix InMat2,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_2k_update(InMat1 A, InMat2 B, InOutMat C,
                                     Triangle t);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void symmetric_matrix_rank_2k_update(ExecutionPolicy&& exec,
                                     InMat1 A, InMat2 B, InOutMat C,
                                     Triangle t);
 
// 秩-2k 厄米特矩阵更新matrix update
template<__in_matrix InMat1, __in_matrix InMat2,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void hermitian_matrix_rank_2k_update(InMat1 A, InMat2 B, InOutMat C,
                                     Triangle t);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, __in_matrix InMat2,
         __possibly_packed_inout_matrix InOutMat, class Triangle>
void hermitian_matrix_rank_2k_update(ExecutionPolicy&& exec,
                                     InMat1 A, InMat2 B, InOutMat C,
                                     Triangle t);
 
// 求解多个三角形的线性系统
// 三角形矩阵在左侧
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat, class BinaryDivideOp>
void triangular_matrix_matrix_left_solve(InMat1 A,
                                         Triangle t, DiagonalStorage d,
                                         InMat2 B, OutMat X,
                                         BinaryDivideOp divide);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat, class BinaryDivideOp>
void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec,
                                         InMat1 A,
                                         Triangle t, DiagonalStorage d,
                                         InMat2 B, OutMat X,
                                         BinaryDivideOp divide);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat, class BinaryDivideOp>
void triangular_matrix_matrix_left_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                         InOutMat B, BinaryDivideOp divide);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat, class BinaryDivideOp>
void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec,
                                         InMat1 A, Triangle t, DiagonalStorage d,
                                         InOutMat B, BinaryDivideOp divide);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_matrix_left_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                         InMat2 B, OutMat X);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec,
                                         InMat1 A, Triangle t, DiagonalStorage d,
                                         InMat2 B, OutMat X);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_matrix_left_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                         InOutMat B);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_matrix_left_solve(ExecutionPolicy&& exec,
                                         InMat1 A, Triangle t, DiagonalStorage d,
                                         InOutMat B);
 
// 求解多个三角形的线性系统
// 三角形矩阵在右侧
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat, class BinaryDivideOp>
void triangular_matrix_matrix_right_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                          InMat2 B, OutMat X, BinaryDivideOp divide);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat, class BinaryDivideOp>
void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec,
                                          InMat1 A, Triangle t, DiagonalStorage d,
                                          InMat2 B, OutMat X, BinaryDivideOp divide);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat, class BinaryDivideOp>
void triangular_matrix_matrix_right_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                          InOutMat B, BinaryDivideOp divide);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat, class BinaryDivideOp>
void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec,
                                          InMat1 A, Triangle t, DiagonalStorage d,
                                          InOutMat B, BinaryDivideOp divide));
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_matrix_right_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                          InMat2 B, OutMat X);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __in_matrix InMat2, __out_matrix OutMat>
void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec,
                                          InMat1 A, Triangle t, DiagonalStorage d,
                                          InMat2 B, OutMat X);
 
template<__in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_matrix_right_solve(InMat1 A, Triangle t, DiagonalStorage d,
                                          InOutMat B);
 
template<class ExecutionPolicy,
         __in_matrix InMat1, class Triangle, class DiagonalStorage,
         __inout_matrix InOutMat>
void triangular_matrix_matrix_right_solve(ExecutionPolicy&& exec,
                                          InMat1 A, Triangle t, DiagonalStorage d,
                                          InOutMat B);
}

标签

namespace std::linalg {
  struct column_major_t {
    explicit column_major_t() = default;
  };
  inline constexpr column_major_t column_major = { };
 
  struct row_major_t {
    explicit row_major_t() = default;
  };
  inline constexpr row_major_t row_major = { };
 
  struct upper_triangle_t {
    explicit upper_triangle_t() = default;
  };
  inline constexpr upper_triangle_t upper_triangle = { };
 
  struct lower_triangle_t {
    explicit lower_triangle_t() = default;
  };
  inline constexpr lower_triangle_t lower_triangle = { };
 
  struct implicit_unit_diagonal_t {
    explicit implicit_unit_diagonal_t() = default;
  };
  inline constexpr implicit_unit_diagonal_t implicit_unit_diagonal = { };
 
  struct explicit_diagonal_t {
    explicit explicit_diagonal_t() = default;
  };
  inline constexpr explicit_diagonal_t explicit_diagonal = { };
}

类模板 std::linalg::layout_blas_packed

namespace std::linalg {
  template<class Triangle, class StorageOrder>
  class layout_blas_packed {
   public:
    template<class Extents>
    struct mapping {
     public:
      using extents_type = Extents;
      using index_type = typename extents_type::index_type;
      using size_type = typename extents_type::size_type;
      using rank_type = typename extents_type::rank_type;
      using layout_type = layout_blas_packed<Triangle, StorageOrder>;
 
     private:
      Extents __the_extents{}; // 仅用于阐释
 
     public:
      constexpr mapping() noexcept = default;
      constexpr mapping(const mapping&) noexcept = default;
      constexpr mapping(const extents_type& e) noexcept;
      template<class OtherExtents>
      constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
      mapping(const mapping<OtherExtents>& other) noexcept;
 
      constexpr mapping& operator=(const mapping&) noexcept = default;
 
      constexpr extents_type extents() const noexcept { return the-extents; }
 
      constexpr size_type required_span_size() const noexcept;
 
      template<class Index0, class Index1>
      constexpr index_type operator() (Index0 ind0, Index1 ind1) const noexcept;
 
      static constexpr bool is_always_unique() {
        return (extents_type::static_extent(0) != dynamic_extent &&
                extents_type::static_extent(0) < 2) ||
               (extents_type::static_extent(1) != dynamic_extent &&
                extents_type::static_extent(1) < 2);
      }
      static constexpr bool is_always_exhaustive() { return true; }
      static constexpr bool is_always_strided() {
        return is_always_unique();
      }
 
      constexpr bool is_unique() const noexcept {
        return __the_extents.extent(0) < 2;
      }
      constexpr bool is_exhaustive() const noexcept { return true; }
      constexpr bool is_strided() const noexcept {
        return __the_extents.extent(0) < 2;
      }
 
      constexpr index_type stride(rank_type) const noexcept;
 
      template<class OtherExtents>
      friend constexpr bool
      operator==(const mapping&, const mapping<OtherExtents>&) noexcept;
 
    };
  };
}

类模板 std::linalg::scaled_accessor

namespace std::linalg {
  template<class ScalingFactor, class NestedAccessor>
  class scaled_accessor {
   public:
    using element_type = 
      add_const_t<decltype(declval<ScalingFactor>() * 
                           declval<NestedAccessor::element_type>())>;
    using reference = remove_const_t<element_type>;
    using data_handle_type = NestedAccessor::data_handle_type;
    using offset_policy = scaled_accessor<ScalingFactor, NestedAccessor::offset_policy>;
 
    constexpr scaled_accessor() = default;
    template<class OtherNestedAccessor>
      explicit(!is_convertible_v<OtherNestedAccessor, NestedAccessor>)
    constexpr scaled_accessor(const scaled_accessor<ScalingFactor, OtherNestedAccessor>&);
    constexpr scaled_accessor(const ScalingFactor& s, const Accessor& a);
 
    constexpr reference access(data_handle_type p, size_t i) const noexcept;
    constexpr 
      offset_policy::data_handle_type offset(data_handle_type p, size_t i) const noexcept;
 
    constexpr const ScalingFactor& scaling_factor() const noexcept 
      { return __scaling_factor; } 
    constexpr const NestedAccessor& nested_accessor() const noexcept
      { return __nested_accessor; }
 
   private:
    ScalingFactor __scaling_factor; // 仅用于阐释
    NestedAccessor __nested_accessor; // 仅用于阐释
  };
}

类模板 std::linalg::conjugated_accessor

namespace std::linalg {
  template<class NestedAccessor>
  class conjugated_accessor {
   private:
    NestedAccessor __nested_accessor; // 仅用于阐释
 
   public:
    using element_type =
      add_const_t<decltype(/*conj-if-needed*/(declval<NestedAccessor::element_type>()))>;
    using reference = remove_const_t<element_type>;
    using data_handle_type = typename NestedAccessor::data_handle_type;
    using offset_policy = conjugated_accessor<NestedAccessor::offset_policy>;
 
    constexpr conjugated_accessor() = default;
    template<class OtherNestedAccessor>
      explicit(!is_convertible_v<OtherNestedAccessor, NestedAccessor>)
      constexpr conjugated_accessor(const conjugated_accessor<OtherNestedAccessor>& other);
 
    constexpr reference access(data_handle_type p, size_t i) const;
 
    constexpr typename offset_policy::data_handle_type
      offset(data_handle_type p, size_t i) const;
 
    constexpr const NestedAccessor& nested_accessor() const noexcept
      { return __nested_accessor; }
  };
}

类模板 std::linalg::layout_transpose

namespace std::linalg {
  template<class InputExtents>
  using __transpose_extents_t = /* 见说明 */; // 仅用于阐释
 
  template<class Layout>
  class layout_transpose {
   public:
    using nested_layout_type = Layout;
 
    template<class Extents>
    struct mapping {
     private:
      using __nested_mapping_type =
        typename Layout::template mapping<
          __transpose_extents_t<Extents>>;    // 仅用于阐释
 
      __nested_mapping_type __nested_mapping; // 仅用于阐释
        extents_type __extents;               // 仅用于阐释
 
     public:
      using extents_type = Extents;
      using index_type = typename extents_type::index_type;
      using size_type = typename extents_type::size_type;
      using rank_type = typename extents_type::rank_type;
      using layout_type = layout_transpose;
 
      constexpr explicit mapping(const __nested_mapping_type& map);
 
      constexpr const extents_type& extents() const noexcept { return __extents; }
 
      constexpr index_type required_span_size() const
        { return __nested_mapping.required_span_size(); }
 
      template<class Index0, class Index1>
        constexpr index_type operator()(Index0 ind0, Index1 ind1) const
        { return __nested_mapping(ind1, ind0); }
 
      constexpr const __nested_mapping_type& nested_mapping() const noexcept
        { return __nested_mapping; }
 
      static constexpr bool is_always_unique() noexcept
        { return __nested_mapping_type::is_always_unique(); }
      static constexpr bool is_always_exhaustive() noexcept
        { return __nested_mapping_type::is_always_exhaustive(); }
      static constexpr bool is_always_strided() noexcept
        { return __nested_mapping_type::is_always_strided(); }
 
      constexpr bool is_unique() const 
        { return __nested_mapping.is_unique(); }
      constexpr bool is_exhaustive() const 
        { return __nested_mapping.is_exhaustive(); }
      constexpr bool is_strided() const 
        { return __nested_mapping.is_strided(); }
 
      constexpr index_type stride(size_t r) const;
 
      template<class OtherExtents>
      friend constexpr bool
        operator==(const mapping& x, const mapping<OtherExtents>& y);
    };
  };
}

辅助概念和特征

namespace std::linalg {
  template<class T>
  struct __is_mdspan : false_type {}; // 仅用于阐释
 
  template<class ElementType, class Extents, class Layout, class Accessor>
  struct __is_mdspan<mdspan<ElementType, Extents, Layout, Accessor>>
  : true_type {}; // 仅用于阐释
 
  template<class T>
  concept __in_vector = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 1;
 
  template<class T>
  concept __out_vector = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 1 &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    T::is_always_unique();
 
  template<class T>
  concept __inout_vector = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 1 &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    T::is_always_unique();
 
  template<class T>
  concept __in_matrix = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 2;
 
  template<class T>
  concept __out_matrix = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 2 &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
   T::is_always_unique();
 
  template<class T>
  concept __inout_matrix = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 2 &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    T::is_always_unique();
 
  template<class T>
  concept __possibly_packed_inout_matrix = // 仅用于阐释
    __is_mdspan<T>::value &&
    T::rank() == 2 &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    (T::is_always_unique() || is_same_v<typename T::layout_type, layout_blas_packed>);
 
  template<class T>
  concept __in_object = // 仅用于阐释
    __is_mdspan<T>::value &&
    (T::rank() == 1 || T::rank() == 2);
 
  template<class T>
  concept __out_object = // 仅用于阐释
    __is_mdspan<T>::value &&
    (T::rank() == 1 || T::rank() == 2) &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    T::is_always_unique();
 
  template<class T>
  concept __inout_object = // 仅用于阐释
    __is_mdspan<T>::value &&
    (T::rank() == 1 || T::rank() == 2) &&
    is_assignable_v<typename T::reference, typename T::element_type> &&
    T::is_always_unique();
}