LMMC
Lamina Mathematic core
载入中...
搜索中...
未找到
sparse_arithmetic.c 文件参考

稀疏矩阵算术:线性组合、缩放、Frobenius 范数与对角线提取。 更多...

#include "memory_bridge.h"
#include "internal.h"
#include "sparse_internal.h"
#include "lmmc/sparse.h"
sparse_arithmetic.c 的引用(Include)关系图:

浏览该文件的源代码.

函数

lmmc_status_t lmmc_sparse_add (lmmc_real_t alpha, const lmmc_sparse_mat_t *a, lmmc_real_t beta, const lmmc_sparse_mat_t *b, lmmc_sparse_mat_t *out_c)
 计算 C = alpha * A + beta * B .要求 a 与 b 同维同格式。
lmmc_status_t lmmc_sparse_scale (lmmc_sparse_mat_t *a, lmmc_real_t alpha)
 就地标量缩放: \(A \leftarrow \alpha A\) 。
lmmc_status_t lmmc_sparse_norm_fro (const lmmc_sparse_mat_t *a, lmmc_real_t *out_norm)
 用缩放平方和计算稀疏矩阵的 Frobenius 范数。
lmmc_status_t lmmc_sparse_diag (const lmmc_sparse_mat_t *a, lmmc_vec_t *out_diag)
 提取主对角线为稠密向量.要求 a->rows == a->cols 。

详细描述

稀疏矩阵算术:线性组合、缩放、Frobenius 范数与对角线提取。

在文件 sparse_arithmetic.c 中定义.

函数说明

◆ lmmc_sparse_add()

lmmc_status_t lmmc_sparse_add ( lmmc_real_t alpha,
const lmmc_sparse_mat_t * a,
lmmc_real_t beta,
const lmmc_sparse_mat_t * b,
lmmc_sparse_mat_t * out_c )

计算 C = alpha * A + beta * B .要求 a 与 b 同维同格式。

在文件 sparse_arithmetic.c 第 132 行定义.

引用了 lmmc_sparse_mat_t::col_idx, lmmc_sparse_mat_t::cols, lmmc_sparse_mat_t::format, lmmc_memory_alloc_array_plus(), lmmc_memory_free(), LMMC_REAL_CLEAR, lmmc_sparse_add(), LMMC_SPARSE_CSC, LMMC_SPARSE_CSR, lmmc_sparse_destroy(), lmmc_sparse_to_csr(), LMMC_STATUS_ALLOCATION_FAILED, LMMC_STATUS_OK, lmmc_sparse_mat_t::nnz, lmmc_sparse_mat_t::owns_data, lmmc_sparse_mat_t::row_ptr, lmmc_sparse_mat_t::rows , 以及 lmmc_sparse_mat_t::values.

被这些函数引用 lmmc_sparse_add().

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

◆ lmmc_sparse_scale()

lmmc_status_t lmmc_sparse_scale ( lmmc_sparse_mat_t * a,
lmmc_real_t alpha )

就地标量缩放: \(A \leftarrow \alpha A\) 。

在文件 sparse_arithmetic.c 第 226 行定义.

引用了 LMMC_REAL_CLEAR, LMMC_REAL_INIT, LMMC_REAL_MUL, LMMC_REAL_SET, lmmc_sparse_scale(), LMMC_STATUS_INVALID_ARGUMENT, LMMC_STATUS_OK, lmmc_sparse_mat_t::nnz , 以及 lmmc_sparse_mat_t::values.

被这些函数引用 lmmc_sparse_scale().

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

◆ lmmc_sparse_norm_fro()

lmmc_status_t lmmc_sparse_norm_fro ( const lmmc_sparse_mat_t * a,
lmmc_real_t * out_norm )

用缩放平方和计算稀疏矩阵的 Frobenius 范数。

在文件 sparse_arithmetic.c 第 251 行定义.

引用了 lmmc_sparse_norm_fro(), LMMC_STATUS_INVALID_ARGUMENT, LMMC_STATUS_OK, lmmc_sparse_mat_t::nnz , 以及 lmmc_sparse_mat_t::values.

被这些函数引用 lmmc_sparse_norm_fro().

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

◆ lmmc_sparse_diag()

lmmc_status_t lmmc_sparse_diag ( const lmmc_sparse_mat_t * a,
lmmc_vec_t * out_diag )

提取主对角线为稠密向量.要求 a->rows == a->cols 。

在文件 sparse_arithmetic.c 第 274 行定义.

引用了 lmmc_sparse_mat_t::cols, lmmc_vec_t::data, lmmc_sparse_mat_t::format, LMMC_REAL_CLEAR, LMMC_REAL_INIT, LMMC_REAL_SET_D, LMMC_SPARSE_CSC, lmmc_sparse_destroy(), lmmc_sparse_diag(), lmmc_sparse_to_csr(), LMMC_STATUS_INVALID_ARGUMENT, LMMC_STATUS_OK, lmmc_vec_create(), lmmc_vec_destroy(), lmmc_vec_fill(), lmmc_vec_t::owns_data, lmmc_sparse_mat_t::rows , 以及 lmmc_vec_t::size.

被这些函数引用 lmmc_sparse_diag().

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