eigen

Eigen efficient type for dense symmetric matrix

与世无争的帅哥 提交于 2019-12-23 06:52:02
问题 Does Eigen have efficient type for store dense, fixed-size, symmetric matrix? (hey, they are ubiquitous!) I.e. for N=9, it should store only (1+9)*9/2==45 elements and it has appropriate operations. For instance there should be efficient addition of two symmetric matrices, which returns simmilar symmetric matrix. If there is no such thing, which actions (looks like this) I should make to introduce such type to Eigen? Does it has concepts of "Views"? Can I write something like "matrix view"

Using Boost Accumulators with Eigen::Vector types

≯℡__Kan透↙ 提交于 2019-12-23 05:29:23
问题 I am having some problems combining Eigen::VectorXd types with the Boost accumulator library: #include <iostream> #include <Eigen/Core> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> using namespace boost::accumulators; using namespace Eigen; int main() { Vector2f a(1.0, 2.0), b(3.0, 10.0); accumulator_set<Vector2f, stats<tag::mean> > acc(Vector2f::Zero()); acc(a); acc(b); std::cout << mean

Problems using eigens Tensor class

℡╲_俬逩灬. 提交于 2019-12-23 04:09:28
问题 I would like to use eigens Tensor class from the unsupported module. This site suggests to include something like #include <Eigen/CXX11/Tensor> to be able to use it. I installed eigen via Homebrew (Version 3.2.4) on my Mac on OS X Yosemite. Although I get eigen to work properly, I cannot find the necessary module in the unsupported folder: #include <eigen3/unsupported/Eigen/???> What might I have forgotten or done wrong? Or do I have an outdated version which does not have yet the Tensor

cygwin_exception::open_stackdumpfile: Dumping stack trace to *.exe.stackdump

时间秒杀一切 提交于 2019-12-23 03:11:03
问题 I am getting "cygwin_exception::open_stackdumpfile: Dumping stack trace to TestProject.exe.stackdump" error. My project is nothing but a C++ HalloWorld project that contains an additional class in which I set and get a variable. I am getting this error at the line I try to set a matrix variable of type Eigen. Here is my code: TestProject.cpp #include <iostream> #include "TestClass.hpp" using namespace std; int main() { cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! TestClass

Eigen library memory usage for dynamic vectors

故事扮演 提交于 2019-12-23 03:02:03
问题 I have a binary file storing float32 objects (9748422*5 of them). From such a collection (190MB roughly in size), I'm creating a set of Eigen::VectorXd vectors (each with 5 components), thus 9748422 of them. The underlying type is double , hence roughly double the input size for storing them. But, as luck has it, the process requires a total of 2.5GB. This is a log of the PROCESS_MEMORY_COUNTERS : PageFaultCount: 0x000A3C40 PeakWorkingSetSize: 0xA3C42000 WorkingSetSize: 0xA3C42000

Is there any way to convert an Eigen::Matrix back to itk::image?

陌路散爱 提交于 2019-12-23 02:26:51
问题 I used Eigen library to convert several itk::image images into matrices, and do some dense linear algebra computations on them. Finally, I have the output as a matrix, but I need it in itk::image form. Is there any way to do this? const unsigned int numberOfPixels = importSize[0] * importSize[1]; float* array1 = inverseU.data(); float* localBuffer = new float[numberOfPixels]; std::memcpy(localBuffer, array1, numberOfPixels); const bool importImageFilterWillOwnTheBuffer = true; importFilter-

Convert Eigen Affine3d to Affine2d

我与影子孤独终老i 提交于 2019-12-22 18:22:21
问题 I have an affine transform in 3D and I wish to discard any z-axis information from. Is there a convenient way to convert from an Affine3d to and Affine2d ? 回答1: Try following: Affine2d S2d = Translation2d(S3d.translation().topRows<2>()) * S3d.linear().topLeftCorner<2,2>(); Demo: #include <Eigen/Dense> #include <iostream> #include <string> int main() { using namespace Eigen; using namespace std; Vector3d p3d(1.,2.,3.); cout << p3d << endl << endl; Affine3d S3d = Translation3d(2.,2.,2.)*Scaling

Map two-dimensional array to Eigen::Matrix

一笑奈何 提交于 2019-12-22 09:04:10
问题 I can't figure out if and how it's possible to map a two-dimensional double array to an Eigen::Matrix. Is it possible to map an array double d[][] which I receive as double** p to an Eigen::Matrix? While one-dimensinal arrays work fine, I wasn't able to map p to Eigen::Map<Eigen::Matrix<double, n, n>> . Is that possible and how could it be done? The size n is not really constant, but I could accept a hard coded size. I tried several versions, but none worked. I thought the following should

Making a reshape function in Eigen

岁酱吖の 提交于 2019-12-22 00:11:08
问题 Here's the code for a reshape function in Eigen. It works. typedef MatrixXd mat; typedef VectorXd vec; Map<mat> reshape (vec b, const uint n, const uint m) { return Map<mat>(b.data(), n, m); } I was trying to decide the right type for the first argument. vec & b still works, but I get strange errors with const vec & b or const vec b : error: invalid conversion from 'const Scalar* {aka const double*}' to 'Eigen::Map<Eigen::Matrix<double, -1, -1> >::PointerArgType {aka double*}' [-fpermissive]

Eigen3 matrix multiplication performance

谁说胖子不能爱 提交于 2019-12-21 20:08:24
问题 Note: I've posted this also on Eigen forum here I want to premultiply 3xN matrices by a 3x3 matrix, i.e., to transform 3D points, like p_dest = T * p_source after initializing the matrices: Eigen::Matrix<double, 3, Eigen::Dynamic> points = Eigen::Matrix<double, 3, Eigen::Dynamic>::Random(3, NUMCOLS); Eigen::Matrix<double, 3, Eigen::Dynamic> dest = Eigen::Matrix<double, 3, Eigen::Dynamic>(3, NUMCOLS); int NT = 100; I have evaluated this two versions // eigen direct multiplication for (int i =