matrix()转换为数组 html,将Eigen :: PermutationMatrix.indices()转换为数组/矢量

我想将Eigen::PermutationMatrix的公共方法indices()的返回值存储为一个数组(例如,稍后提取一些感兴趣的值)。将Eigen :: PermutationMatrix.indices()转换为数组/矢量

我应该如何将其转换为数组(Eigen::Array或C++ STL向量)?

这里是我的尝试:

Eigen::FullPivLU<:matrixxf> lu(LU_A); //LU_A is of type Eigen::MatrixXf

Eigen::ArrayXXf lins;

lins = lu.permutationP().indices().cast().array(); //trows an error

错误:

In file included from /home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/Core:347:0,

from /home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/Dense:1,

from Matrice.hpp:5,

from Matrice.cpp:1:

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/AssignEvaluator.h: In instantiation of ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Array; Src = Eigen::ArrayWrapper >; Func = Eigen::internal::assign_op]’:

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/AssignEvaluator.h:804:27: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename Eigen::internal::enable_if::value), void*>::type) [with Dst = Eigen::Array; Src = Eigen::ArrayWrapper >; Func = Eigen::internal::assign_op; typename Eigen::internal::enable_if::value), void*>::type = void*]’

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/AssignEvaluator.h:782:18: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Array; Src = Eigen::ArrayWrapper >]’

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/PlainObjectBase.h:710:32: required from ‘Derived& Eigen::PlainObjectBase::_set(const Eigen::DenseBase&) [with OtherDerived = Eigen::ArrayWrapper >; Derived = Eigen::Array]’

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/Array.h:109:24: required from ‘Eigen::Array<_scalar _rows _cols _options _maxrows _maxcols>& Eigen::Array<_scalar _rows _cols _options _maxrows _maxcols>::operator=(const Eigen::DenseBase&) [with OtherDerived = Eigen::ArrayWrapper >; _Scalar = float; int _Rows = -1; int _Cols = -1; int _Options = 0; int _MaxRows = -1; int _MaxCols = -1]’

Matrice.cpp:380:58: required from here

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY

#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/util/XprHelper.h:816:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’

EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType >::value), \

^~~~~~~~~~~~~~~~~~~

/home/ldfzor/Documents/CodeBlocks_Projects/POO_Matrice_Eigen/eigen3_3_3/Eigen/src/Core/AssignEvaluator.h:834:3: note: in expansion of macro ‘EIGEN_CHECK_BINARY_COMPATIBILIY’

EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);

2017-03-17

DFlorin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值