gpt4 book ai didi

c++ - 如何通过q​​pOASES的SymSparseMat类创建对称稀疏矩阵?

转载 作者:行者123 更新时间:2023-12-02 10:26:56 25 4
gpt4 key购买 nike

我看过hpp文件,了解如何通过q​​pOASES的SymSparseMat类创建创建对称稀疏矩阵,需要输入五个参数:

                  int_t nr,           /**< Number of rows. */
int_t nc, /**< Number of columns. */
sparse_int_t* r, /**< Row indices (length). */
sparse_int_t* c, /**< Indices to first entry of columns (nCols+1). */
real_t* v /**< Vector of entries (length). */

我不知道 第三至第五参数的含义。谁能给我一个简单的例子(例如3 * 3矩阵)来解释这3个参数代表什么?
提前致谢!

最佳答案

qpOASES manual PDF说“存储稀疏矩阵
列压缩存储格式。” Aka CCS或CSC格式。请参阅explanation on Wikipedia的含义。
examples/qrecipe.cpp中有一个示例用法:

/* create sparse matrices */
SymSparseMat *H = new SymSparseMat(180, 180, H_ir, H_jc, H_val);
SparseMatrix *A = new SparseMatrix(91, 180, A_ir, A_jc, A_val);

其中在 qrecipe_data.hpp中大约定义了H_ir,H_jc等。

关于c++ - 如何通过q​​pOASES的SymSparseMat类创建对称稀疏矩阵?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64020511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com