eigen

How to check the version number of Eigen C++ template library?

ぐ巨炮叔叔 提交于 2019-12-21 03:16:08
问题 I added several different versions of Eigen to default including directory of Visual C++. But I got collapse problem when using LDLT (Cholesky decomposition) for some of the testing numerical examples. So I want to determine which version is actually active when debugging the code. Is there any function which can indicate the current active Eigen version number? 回答1: This answer is only a summary from the comments above: At compile-time you have EIGEN_WORLD_VERSION , EIGEN_MAJOR_VERSION and

Eigen Matrix vs Numpy Array multiplication performance

若如初见. 提交于 2019-12-21 01:13:06
问题 I read in this question that eigen has very good performance. However, I tried to compare eigen MatrixXi multiplication speed vs numpy array multiplication. And numpy performs better (~26 seconds vs. ~29). Is there a more efficient way to do this eigen ? Here is my code: Numpy: import numpy as np import time n_a_rows = 4000 n_a_cols = 3000 n_b_rows = n_a_cols n_b_cols = 200 a = np.arange(n_a_rows * n_a_cols).reshape(n_a_rows, n_a_cols) b = np.arange(n_b_rows * n_b_cols).reshape(n_b_rows, n_b

The future of C++ alignment: passing by value?

橙三吉。 提交于 2019-12-20 17:32:44
问题 Reading the Eigen library documentation, I noticed that some objects cannot be passed by value. Are there any developments in C++11 or planned developments that will make it safe to pass such objects by value? Also, why is there no problem with returning such objects by value? 回答1: They could do this in C++11: class alignas(16) Matrix4f { // ... }; Now the class will always be aligned on a 16-byte boundary. Also, maybe I'm being silly but this shouldn't be an issue anyway. Given a class like

Euler to Quaternion / Quaternion to Euler using Eigen

老子叫甜甜 提交于 2019-12-20 14:43:54
问题 I'm trying to implement a functionality that can convert an Euler angle into an Quaternion and back "YXZ"-convention using Eigen. Later this should be used to let the user give you Euler angles and rotate around as Quaternion and convert Back for the user. In fact i am realy bad at math but tried my best. I have no Idea if this matrices are correct or anything. The code Works, but my results are way to off, i suppose. Any idea where i take the wrong turn? This is what my Quat.cpp looks like:

How to work with Eigen in CUDA kernels

僤鯓⒐⒋嵵緔 提交于 2019-12-20 12:02:18
问题 Eigen is a c++ linear algebra library http://eigen.tuxfamily.org. It's easy to work with basic data types, like basic float arrays, and just copy it to device memory and pass the pointer to cuda kernels. But Eigen matrix are complex type so how to copy it to device memory and let cuda kernels read/write with it? 回答1: If all you want is to access the data of an Eigen::Matrix via a raw C pointer, then you can use the .data() function. Coefficient are stored sequentially in memory in a column

How can the C++ Eigen library perform better than specialized vendor libraries?

孤人 提交于 2019-12-20 08:26:04
问题 I was looking over the performance benchmarks: http://eigen.tuxfamily.org/index.php?title=Benchmark I could not help but notice that eigen appears to consistently outperform all the specialized vendor libraries. The questions is: how is it possible? One would assume that mkl/goto would use processor specific tuned code, while eigen is rather generic. Notice this http://download.tuxfamily.org/eigen/btl-results-110323/aat.pdf, essentially a dgemm. For N=1000 Eigen gets roughly 17Gf, MKL only

VS2019 使用Eigen发生以下错误C2280

岁酱吖の 提交于 2019-12-20 06:51:50
VS2019 使用Eigen发生以下错误: 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C2280 “Eigen::Block<Eigen::Block<Eigen::Map<Derived,0,Eigen::Stride<0,0>>,-1,-1,false,true>,-1,-1,false,true> &Eigen::Block<Eigen::Block<Eigen::Map<Derived,0,Eigen::Stride<0,0>>,-1,-1,false,true>,-1,-1,false,true>::operator = (const Eigen::Block<Eigen::Block<Eigen::Map<Derived,0,Eigen::Stride<0,0>>,-1,-1,false,true>,-1,-1,false,true> &)”: 尝试引用已删除的函数 TestWeldBlank d:\eigen3.07\eigen\src\core\solvetriangular.h 194 解决方法:重新下找Eigen,配置新的文件路径。 来源: CSDN 作者: AI机器学习与数据挖掘 链接: https://blog.csdn.net/weixin_40437821/article/details/103616176

C++: Eigen conservativeResize too expensive?

天涯浪子 提交于 2019-12-20 04:20:03
问题 I have some Eigen Matrices whose dimensions I don't know in advance, I only have an upper bound. I have a loop in which I fill those matrices (I initialize them using the upper bound) column by column until a stopping criterion is fulfilled (let's say after j iterations). My problem is now: After the loop, I need those matrices for matrix multiplications (obviously using only the first j columns). The straightforward solution would be to use Eigen's conservativeResize and go right ahead and

Eigen 中四元数、欧拉角、旋转矩阵、旋转向量

这一生的挚爱 提交于 2019-12-20 03:59:22
一、旋转向量 1.0 初始化旋转向量:旋转角为alpha,旋转轴为(x,y,z) Eigen::AngleAxisd rotation_vector(alpha,Vector3d(x,y,z)) 1.1 旋转向量转旋转矩阵 Eigen::Matrix3d rotation_matrix; rotation_matrix=rotation_vector.matrix(); Eigen::Matrix3d rotation_matrix; rotation_matrix=rotation_vector.toRotationMatrix(); 1.2 旋转向量转欧拉角(Z-Y-X,即RPY) Eigen::Vector3d eulerAngle=rotation_vector.matrix().eulerAngles(2,1,0); 1.3 旋转向量转四元数 Eigen::Quaterniond quaternion(rotation_vector); Eigen::Quaterniond quaternion;Quaterniond quaternion; Eigen::Quaterniond quaternion;quaternion=rotation_vector; 二、旋转矩阵 2.0 初始化旋转矩阵 Eigen::Matrix3d rotation_matrix;

Rewriting Matlab eig(A,B) (Generalized eigenvalues/eigenvectors) to C/C++

江枫思渺然 提交于 2019-12-19 09:47:06
问题 Do anyone have any idea how can I rewrite eig(A,B) from Matlab used to calculate generalized eigenvector/eigenvalues? I've been struggling with this problem lately. So far: Matlab definition of eig function I need: [V,D] = eig(A,B) produces a diagonal matrix D of generalized eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that A*V = B*V*D. So far I tried the Eigen library (http://eigen.tuxfamily.org/dox/classEigen_1_1GeneralizedSelfAdjointEigenSolver.html)