如何解决为什么必须为特定类型设置Eigen :: DontAlign以避免错误?
正如标题所述,我对为什么必须为我的一种矩阵类型设置Eigen::DontAlign
感到好奇?我已经创建了几个robot
类,例如:
class TwoLinkRobot
{
public:
...
Matrix2x2F motorGearRatio; // Diagonal Matrix of the Gear Ratios //
};
// Shared Pointer to the Robot //
using sharedTwoLinkRobot = std::shared_ptr<TwoLinkRobot>;
class ThreeLinkRobot
{
public:
...
Matrix3x3F motorGearRatio; // Diagonal Matrix of the Gear Ratios //
};
// Shared Pointer to the Robot //
using sharedThreeLinkRobot = std::shared_ptr<ThreeLinkRobot>;
我创建了一些示例来测试并确保一切正常。在我的两个链接示例中,我创建了指向机械手类的共享指针,并且在初始化twoLinkRobot
(并且只有两个链接机械手)的过程中,出现以下错误:
Eigen :: internal :: plain_array
在网站和各种在线文章上进行阅读,我能够摆脱该错误的唯一方法是设置以下矩阵之一:
using Matrix2x2F = Eigen::Matrix<float,2,Eigen::DontAlign>; // Why is this the only one that needs to change?
using Matrix5x5F = Eigen::Matrix<float,5,5>;
using Matrix9x9F = Eigen::Matrix<float,9,9>;
using Vector6x1F = Eigen::Matrix<float,6,1>;
using Matrix3x9F = Eigen::Matrix<float,3,9>;
...
所以,基本上,我的问题是:
- 为什么我必须更改2x2矩阵,而不要更改其他任何矩阵,例如3x3、5x5或9x9?
- 通过设置
Eigen::DontAlign
,我已禁用了该矩阵类型的矢量化功能。我不完全知道那是什么意思。与其他矩阵相比,2x2矩阵在性能方面是否会达到次优状态?
对我来说,我总体上感觉我在对代码进行修改,以使其在运行时不引发任何错误,并且想知道为什么必须这样做,以期希望我能够学习如何解决此问题如果有的话,以一种更合适的方式。
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。