【问题标题】:Is there an equivalent to triu_indices (numpy) in Eigen?Eigen 中是否有与 triu_indices (numpy) 等价的东西?
【发布时间】:2021-09-17 06:56:07
【问题描述】:

我想将矩阵 (3x3) 的上三角部分提取为向量。

在带有 numpy 的 python 中,我可以执行以下操作:

myMat = myMat[np.triu_indices(3)] 

cpp 中是否有与 Eigen 等价的东西?

【问题讨论】:

    标签: python c++ numpy eigen


    【解决方案1】:

    刚刚找到了 Eigen 等效项:

    myMat.topRightCorner(3,3)
    

    【讨论】:

    • topRightCorner 返回右上角的块,而不是上三角矩阵。
    • 是的,我刚刚意识到这一点。你有解决办法吗?
    猜你喜欢
    • 2022-01-10
    • 2018-05-26
    • 2014-10-14
    • 2012-12-30
    • 2020-07-21
    • 1970-01-01
    • 2018-06-01
    • 2018-01-07
    • 2011-11-16
    相关资源
    最近更新 更多