eigen3

How to reshape a tensor in Eigen3?

女生的网名这么多〃 提交于 2020-01-15 11:06:10
问题 I get some Eigen::TensorMap from the outputs vector from a tensorflow session in C++. I want to do some operations to the Eigen::TensorMap (reshape and concat etc.). However, my codes cannot be compiled due to some weird error. I tried to reproduce it in pure Eigen3 code. #include <unsupported/Eigen/CXX11/Tensor> using Eigen::Tensor; using Eigen::TensorMap; using Eigen::TensorRef; using std::vector; int main() { int storage[128]; TensorMap<Tensor<int, 4>> t_4d(storage, 2, 4, 2, 8); vector

No speed-up after using MKL for Eigen

倖福魔咒の 提交于 2020-01-06 15:43:10
问题 I use Eigen 3.3 and Intel MKL 2017, and write and run program in Visual Studio 2012 with Win-7 64-bit system and Intel Xeon(R) CPU E5-1620 v2@3.70GHZ CPU. I belive that my configuration for MKL is correct, because I can succesfully run MKL examlpe codes. The configuraton for using Intel MKL from Eigen follows from https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html. For Visiual Studio 2012, I complie codes via Intel C++ Complier in Release x64 model. However, the following code always

Eigen segfault no optimizations Solaris

≡放荡痞女 提交于 2020-01-06 14:12:56
问题 I have the following code: #include <Eigen/Dense> struct States { // Eigen::VectorXd v; Eigen::VectorXd v{Eigen::VectorXd::Ones(2)}; States() { // v.resize(2); // v << 1, 1; } }; States st; int main() {} Whenever I build the project under Solaris 11 (with g++4.9), with no optimizations, I get a segfault (core dumped) when running. After some digging and step-by-step debugging I think the faulty line is in DenseCoeffBase.h , inside function copyPacket , namely the line 537 derived().template

Found unsuitable Qt version “5.12.4” from C:/Qt/5.12.4/msvc2015_64/bin/qmake.exe when configuring Eigen 3.3.7 using CMake

流过昼夜 提交于 2020-01-06 06:59:10
问题 Environment: Windows 10 version 1903, 64 bit CMake 3.15.3 Qt 5.12.4 Eigen 3.3.7 Visual Studio 2015 Update 3 Issue: When I run cmake -G"Visual Studio 14 2015 Win64" .. in build folder created in Eigen 3.3.7 root folder, I got the following error message: -- Found unsuitable Qt version "5.12.4" from C:/Qt/5.12.4/msvc2015_64/bin/qmake.exe -- Qt4 not found, so disabling the mandelbrot and opengl demos I have googled for days but the articles are either about other platforms or do not work. For

Eigen3 select rows out based on column conditions

£可爱£侵袭症+ 提交于 2020-01-06 06:57:44
问题 I have a matrix in eigen which is 2 dimensions, such as: 122 443 544 456 0.9 324 435 5465 645 0.8 32 434 545 546 0.778 435 546 6565 656 0.6878 546 6565 656 3453 54 0.7788 5456 546 545 6565 3434 0.244 435 5456 656 656 6565 0.445 ..... I want select all rows (or get it's row index out) when the last column value bigger than 0.3. I know I can do this by iteration all rows and judge the last element, but I have maybe 10000 rows, to do this, iteration will be very slow. Does there any better way

Eigen unaligned array assert

这一生的挚爱 提交于 2020-01-04 06:03:09
问题 I have a class that finds the convex hull of a 2D set of points. It contains a struct which has 2 Eigen::Matrix<double, 2, 1> inside. It looks like this (with many things removed): class Foo{ public: Foo(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>); private: struct edge{ unsigned int a; unsigned int b; Eigen::Matrix<double, 2, 1> slope; double mag; Eigen::Matrix<double, 2, 1> normal; std::vector<unsigned int> list; }; Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> points; std

How to ensure Eigen isometry stays isometric?

冷暖自知 提交于 2020-01-03 16:58:59
问题 I am currently looking into Eigen::Isometry3f , defined as typedef Transform<float,3,Isometry> Isometry3f; . Therewith i cannot, for example, assign an Affine3f to that Isometry3f , which is good to keep the isometry intact. (The reason is, that Mode is checked in the assignment operator of Transform .) I can however - via the Transform::operator(...) , which shortcuts to Transform::m_matrix(...) - do Eigen::Isometry3f iso; iso.setIdentity(); iso(1, 1) = 2; //works (but should not ?!) and

How to wrap Eigen::SparseMatrix over preexistant 3-standard compress row/colum arrays

佐手、 提交于 2020-01-02 16:30:27
问题 NOTE: I allready asked this question, but it was closed because of "too broad" without much explanation. I can't see how this question could be more specific (it deals with a specific class of a specific library for a specific usage...), so I assume that it was something like a "moderator's mistake" and ask it again... I would like to perfom sparse matrix/matrix multiplication using Eigen on sparse matrices. These matrices are already defined in the code I am working on in standard 3-arrays

Using Eigen::VectorXd (Eigen 3.3.4) as a state type in boost::numeric::odeint (Boost 1.65.1)

谁说我不能喝 提交于 2020-01-01 16:37:22
问题 During my work, it would be a requirement for me to use Eigen::VectorXcd as state type, to solve a huge linear ODE system. In that project, the matrix in the ODE system is sparse. Multiplying a it with a dense vector can be computed in parallel in a simple way using Eigen. However, I have faced some problems in that situation that I will tell in details below. Currently I am applying a not-so efficient solution, namely, I use arma::cx_vec as state type, and declare the matrix corresponding

Eigen Array indexing

时光毁灭记忆、已成空白 提交于 2019-12-24 19:01:24
问题 I would like to create new Eigen::Array using an index. I know it is possible for Eigen::Matrix , a code is given here. A similar question has also been posted on stackoverflow The question is how to update the following code to work with Eigen::Array #include <iostream> #include <stdio.h> #include <Eigen/Core> using namespace Eigen; template<class ArgType, class RowIndexType, class ColIndexType> class indexing_functor { const ArgType &m_arg; const RowIndexType &m_rowIndices; const