Questions tagged [eigen3]

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Homepage: http://eigen.tuxfamily.org

Please use eigen3 tag specifically for questions related to version 3 of the library.

1014 questions
2
votes
0 answers

c++ accelerate Eigen least squares solver with approximation

I'm solving least squares problems using Eigen. here https://eigen.tuxfamily.org/dox/group__DenseDecompositionBenchmark.html is a good comparison of different solvers to solve for A*x=y in a least squares sense. I have a lot of very similar problems…
matthias_buehlmann
  • 4,641
  • 6
  • 34
  • 76
2
votes
0 answers

Very large difference in results depending on the order of operations

Depending on the sequence of operations of multiplication, the result for floating-point values is very different (for double = 0). For demonstration, I use my matrix values (The result is clearer), but it will work for random initialization. I…
2
votes
1 answer

Why ceres covariance.Compute() seems run forever and not return?

I am trying to write a BA optimizer using Ceres and want to compute the covariances for my optimized results. But the program stuck at covariance.Compute(covariance_blocks, &problem)and it seems never stop computing and runs forever. I debugged deep…
Zhi Li
  • 31
  • 3
2
votes
1 answer

Eigen with custom scalar types: Matrix multiplication with custom type fails with `use of overloaded operator '*' is ambiguous`

I am trying to integrate boost.units into Eigen, following the official documentation. I've also looked at two projects that have done the same, and I've tested the operation with their code as well, although I'm getting the same error (Project 1…
David Wright
  • 464
  • 6
  • 18
2
votes
2 answers

In Eigen c++, how to multiply each row of NxM matrix by a vector of Nx1 scalars?

for example, I have: Matrix points; Matrix scalars; What I want is equavalent to: for(int i=0;i<5;++i){ points.row(i)*=scalars(i); } Are there oneliner that can achieve this? I alreay tried rowwise and array but…
somebody4
  • 505
  • 4
  • 14
2
votes
0 answers

Returning reference to Eigen Quaternion

I have a class with an Eigen::Quaterniond as a protected member variable. I want to access it through the method attitude(). There are three ways I can think to do this right now, and none of them seem to work. This is a minimum working example in a…
2
votes
1 answer

Pybind11 Issue for Eigen Return Type

I am trying to expose data_all which is a vector of data to python using pybind11: struct data { std::vector values; std::vector indices; float x; float y; float z; }; class dataBuffer { public: …
afp_2008
  • 1,940
  • 1
  • 19
  • 46
2
votes
1 answer

Initialize std::array of Eigen::Map

I am writing an interface to some data std::array,4> a. I want to be able to interpret the data as a std::array of Eigen::Map. How can I initialize the std::array given I do not have a default initializer?…
2
votes
0 answers

Eigen: efficient ways to repeatedly operate on sub-matrices

In an algorithm that I want to implement, I need to repeatedly operate on a matrix that is formed by a set of rows taken from another existing matrix. For clarity, I will call "A" the original matrix, and "B" the "working matrix" (consisting in some…
ffusco
  • 68
  • 5
2
votes
1 answer

Custom scalar type in Eigen

I'm currently trying to set up a custom scalar type for use with the Eigen3 library (atm it is a simple wrapper around double). I have followed https://eigen.tuxfamily.org/dox/TopicCustomizing_CustomScalar.html to the best of my knowledge and the…
Raven
  • 2,951
  • 2
  • 26
  • 42
2
votes
2 answers

Eigen: Should i use aligned map for intensive computations?

I want to perform a lot of computations over externally allocated data, especially matrix multiplications. It can be done via Eigen::Map. Unfortunately I'm not an expert in vectorized computations, but as far as i can see it's possible to specify…
Daiver
  • 1,488
  • 3
  • 18
  • 47
2
votes
1 answer

Implement Clip() in Eigen

I have code that clips some value to be between a range centered around 0 like below. Eigen::VectorXd a; Eigen::VecotrXd b; a = a.cwiseMin(b).cwiseMax(-b); // no temporary created here? I want to factor out the logic into a function. One…
bill
  • 650
  • 8
  • 17
2
votes
0 answers

Sparse Matrix Multiplication Speed in Eigen

I am using Sparse Matrices in Eigen and I observe the following behavior: I have the following Sparse Matrices with Column Major storage A [1,766,548 x 3,079,008] with 105,808,194 non-zero elements and B [3,079,008 x 1,766,548] with 9,476,108…
serafeim
  • 21
  • 7
2
votes
0 answers

Eigen set to zero all values close to zero

Let's say I have an Eigen matrix with many values that are close to zero: M = [ 0, 0, 0, 0] [ 0.0045549, -0.048242, 0.0069165, 9.7007e-07] [ 0.048251, 0.004541, -0.0046149, 1.8313e-06] What is…
mcamurri
  • 153
  • 11
2
votes
0 answers

Eigen3 Boost MPFR segfault when alignment is disabled

I'm running into a strange segfault issue when I try to use Boost.Multiprecision to wrap MPFR and disable Eigen's alignment assumptions. Example test code: #include #include #include int…
helloworld922
  • 10,801
  • 5
  • 48
  • 85