LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::detail::matrix_api 命名空间参考

函数

ExactMatrixData exact_matrix_data (const MatrixNode &matrix)
std::shared_ptr< SymbolicExpr > exact_matrix_expression (const ExactMatrixData &matrix)
Result< std::shared_ptr< const MatrixNode > > require_matrix (const std::shared_ptr< SymbolicExpr > &expr, ComputationContext &context, const std::string &operation)
ExpressionResult require_matrix_result (std::shared_ptr< SymbolicExpr > result, const std::string &operation)
Result< std::shared_ptr< const MatrixNode > > require_square_matrix (const std::shared_ptr< SymbolicExpr > &expr, ComputationContext &context, const std::string &operation)

函数说明

◆ exact_matrix_data()

detail::ExactMatrixData LMCAS::detail::matrix_api::exact_matrix_data ( const MatrixNode & matrix)

在文件 symbolic_matrix_support.cpp 第 49 行定义.

49 {
50 detail::ExactMatrixData data{matrix.rows(), matrix.cols(), {}};
51 data.entries.reserve(matrix.rows() * matrix.cols());
52 for (std::size_t row = 0; row < matrix.rows(); ++row) {
53 for (std::size_t column = 0; column < matrix.cols(); ++column) {
54 data.entries.push_back(
55 LMCAS::detail::make_expression_ptr(matrix.get(row, column)));
56 }
57 }
58 return data;
59}
size_t cols() const noexcept
size_t rows() const noexcept
std::shared_ptr< const SymbolicNode > get(size_t r, size_t c) const
获取指定位置的矩阵元素。
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)

引用了 LMCAS::MatrixNode::cols(), LMCAS::detail::ExactMatrixData::entries, exact_matrix_data(), LMCAS::MatrixNode::get(), LMCAS::detail::make_expression_ptr() , 以及 LMCAS::MatrixNode::rows().

被这些函数引用 exact_matrix_data(), LMCAS::matrix_determinant_checked(), LMCAS::matrix_inverse_checked(), LMCAS::matrix_nullspace_checked(), LMCAS::matrix_rank_checked() , 以及 LMCAS::matrix_rref_checked().

函数调用图:
这是这个函数的调用关系图:

◆ exact_matrix_expression()

std::shared_ptr< SymbolicExpr > LMCAS::detail::matrix_api::exact_matrix_expression ( const ExactMatrixData & matrix)

在文件 symbolic_matrix_support.cpp 第 61 行定义.

62 {
64 entries.reserve(matrix.entries.size());
65 for (const auto& entry : matrix.entries) {
66 entries.push_back(LMCAS::detail::node(entry));
67 }
70 matrix.rows, matrix.cols, std::move(entries)));
71}
std::vector< std::shared_ptr< const SymbolicNode > > DenseStorage
稠密存储,按行优先展开。
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
std::shared_ptr< const Node > make_node(Args &&... args)

引用了 LMCAS::detail::ExactMatrixData::cols, LMCAS::detail::ExactMatrixData::entries, exact_matrix_expression(), LMCAS::detail::make_expression_ptr(), LMCAS::detail::make_node(), LMCAS::detail::node() , 以及 LMCAS::detail::ExactMatrixData::rows.

被这些函数引用 exact_matrix_expression(), LMCAS::matrix_inverse_checked() , 以及 LMCAS::matrix_rref_checked().

函数调用图:
这是这个函数的调用关系图:

◆ require_matrix()

Result< std::shared_ptr< const MatrixNode > > LMCAS::detail::matrix_api::require_matrix ( const std::shared_ptr< SymbolicExpr > & expr,
ComputationContext & context,
const std::string & operation )

在文件 symbolic_matrix_support.cpp 第 5 行定义.

9{
10 auto step = context.consume_steps(1, operation);
11 if (!step) return Result<std::shared_ptr<const MatrixNode>>::failure(step.error());
12 if (!expr || !LMCAS::detail::node(expr)) {
14 CasErrc::InvalidArgument, "matrix expression cannot be null", operation);
15 }
16 auto mat = std::dynamic_pointer_cast<const MatrixNode>(LMCAS::detail::node(expr));
17 if (!mat) {
19 CasErrc::InvalidArgument, "expression is not a matrix", operation);
20 }
21 return Result<std::shared_ptr<const MatrixNode>>::success(mat);
22}
ComputationContext const std::string & operation
std::size_t std::size_t ComputationContext & context

引用了 LMCAS::detail::context, LMCAS::InvalidArgument, LMCAS::detail::node(), LMCAS::detail::operation , 以及 require_matrix().

被这些函数引用 LMCAS::matrix_multiply_checked(), LMCAS::matrix_nullspace_checked(), LMCAS::matrix_rank_checked(), LMCAS::matrix_rref_checked(), LMCAS::matrix_solve_linear_checked(), require_matrix() , 以及 require_square_matrix().

函数调用图:
这是这个函数的调用关系图:

◆ require_matrix_result()

ExpressionResult LMCAS::detail::matrix_api::require_matrix_result ( std::shared_ptr< SymbolicExpr > result,
const std::string & operation )

在文件 symbolic_matrix_support.cpp 第 38 行定义.

40{
41 if (!result || !LMCAS::detail::node(result)) {
43 "matrix operation returned an empty expression",
44 operation);
45 }
46 return ExpressionResult::success(std::move(result));
47}
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(std::shared_ptr< SymbolicExpr > value)

引用了 LMCAS::Result< std::shared_ptr< SymbolicExpr > >::failure(), LMCAS::InternalInvariant, LMCAS::detail::node(), LMCAS::detail::operation, require_matrix_result() , 以及 LMCAS::Result< std::shared_ptr< SymbolicExpr > >::success().

被这些函数引用 LMCAS::matrix_reflection_checked(), LMCAS::matrix_rotation_checked(), LMCAS::matrix_scaling_checked() , 以及 require_matrix_result().

函数调用图:
这是这个函数的调用关系图:

◆ require_square_matrix()

Result< std::shared_ptr< const MatrixNode > > LMCAS::detail::matrix_api::require_square_matrix ( const std::shared_ptr< SymbolicExpr > & expr,
ComputationContext & context,
const std::string & operation )

在文件 symbolic_matrix_support.cpp 第 24 行定义.

28{
29 auto mat = require_matrix(expr, context, operation);
30 if (!mat) return mat;
31 if (mat.value()->rows() != mat.value()->cols()) {
33 CasErrc::InvalidArgument, "matrix must be square", operation);
34 }
35 return mat;
36}
Result< std::shared_ptr< const MatrixNode > > require_matrix(const std::shared_ptr< SymbolicExpr > &expr, ComputationContext &context, const std::string &operation)

引用了 LMCAS::detail::context, LMCAS::InvalidArgument, LMCAS::detail::operation, require_matrix() , 以及 require_square_matrix().

被这些函数引用 LMCAS::matrix_characteristic_polynomial_checked(), LMCAS::matrix_determinant_checked(), LMCAS::detail::matrix_eigenspaces_checked(), LMCAS::matrix_eigenvalues_checked(), LMCAS::matrix_inverse_checked() , 以及 require_square_matrix().

函数调用图:
这是这个函数的调用关系图: