博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Eigen库遇到C2719错误的解决办法
阅读量:6653 次
发布时间:2019-06-25

本文共 2458 字,大约阅读时间需要 8 分钟。

 

Cause 1: Structures having Eigen objects as members

If you have code like this,

class Foo

{

//...

v;

//...

};

//...

Foo *foo = new Foo;

then you need to read this separate page: .

Note that here, is only used as an example, more generally the issue arises for all .

Cause 2: STL Containers

If you use STL Containers such as std::vector, std::map, ..., with objects, or with classes containing objects, like this,

std::vector<Eigen::Matrix2f> my_vector;

struct my_class { ... m; ... };

std::map<int, my_class> my_map;

then you need to read this separate page: .

Note that here, is only used as an example, more generally the issue arises for all and .

Cause 3: Passing Eigen objects by value

If some function in your code is getting an object passed by value, like this,

void func( v);

then you need to read this separate page: .

Note that here, is only used as an example, more generally the issue arises for all .

Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows)

This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this:

void foo()

{

q;

//...

}

then you need to read this separate page: .

Note that here, is only used as an example, more generally the issue arises for all .

Explanation

must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions adressing them will crash.

normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".

However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.

I don't care about vectorization, how do I get rid of that stuff?

Two possibilities:

  • Define EIGEN_DONT_ALIGN_STATICALLY. That disables all 128-bit static alignment code, while keeping 128-bit heap alignment. This has the effect of disabling vectorization for fixed-size objects (like Matrix4d) while keeping vectorization of dynamic-size objects (like MatrixXd). But do note that this breaks ABI compatibility with the default behavior of 128-bit static alignment.
  • Or define both EIGEN_DONT_VECTORIZE and EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT. This keeps the 128-bit alignment code and thus preserves ABI compatibility, but completely disables vectorization.

转载于:https://www.cnblogs.com/youthlion/archive/2012/12/26/2834614.html

你可能感兴趣的文章
【C语言】19-static和extern关键字1-对函数的作用
查看>>
分享:C++中头文件、源文件之间的区别与联系
查看>>
好类 笔记
查看>>
Web前端浏览器兼容初探【转】
查看>>
菜鸟开技术博啦
查看>>
关于多线程生命周期原理
查看>>
如何使用U盘安装操作系统 安装GHOST XP, xp纯净版
查看>>
Python学习入门基础教程(learning Python)--5.3 Python写文件基础
查看>>
Sequence one(hdu2610dfs+去重)
查看>>
每日英语:Rethinking How We Watch TV
查看>>
[置顶] EasyMock的简单使用
查看>>
WeakReference and WeakHashMap
查看>>
mmc生产任务分配问题
查看>>
mysql 优化配置参数详解
查看>>
XSS跨站攻击
查看>>
设计模式之建造者模式(七)
查看>>
我开发共享软件的三次经历(上):打造一款很多人用的软件
查看>>
iOS应用程序生命周期(前后台切换,应用的各种状态)详解
查看>>
谷歌调试工具祝你一臂之力买火车票,简单安全方便
查看>>
传输层
查看>>