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
4
votes
0 answers

Eigen allows for thin SVD only for dynamic number of columns in A matrix

I'm calculating a SVD of a matrix using Eigen library. Eigen::Matrix A(points*2, 6); Eigen::Matrix b(points*2); // fill the matrices // ... Eigen::Matrix hVec; hVec =…
maticus
  • 41
  • 3
4
votes
1 answer

Multiple definitions when including Eigen

I just started using Eigen and I've run into a multiple definition issue. I've tracked down the precise issue, and here's a minimal example. Works: // File common1.hpp #include // File common2.hpp #include "common1.hpp" // File…
Chronum
  • 187
  • 6
4
votes
2 answers

Template parameters that depend on other template parameters?

I have found a few similar questions (e.g. this), but none of them really answer mine. Consider this code snippet: template class Variance { double f(const arrtype…
Ash
  • 4,611
  • 6
  • 27
  • 41
4
votes
1 answer

Create Sophus::SE3 object from Eigen Rotation and translation matrix and go back

I am using Eigen and Sophus for my project. All I want to do is create Sophus SE3 object from rotation and translation defined in Eigen, and get the rotation and translation from SE3, but I get different matrix. Here is my code: #include…
Dharma
  • 2,425
  • 3
  • 26
  • 40
4
votes
2 answers

Eigen: Divide each row by last row

I can't quite figure out the syntax for this when using Eigen's rowwise operations... I have an Eigen matrix, and I want to divide each row by the last row. So if we started with a matrix r = [ 0, 1 2, 3 4, 5 ] then after this…
bremen_matt
  • 6,902
  • 7
  • 42
  • 90
4
votes
2 answers

Story behind Derived to MatrixBase conversion

What happens when you pass a matrix object into a function as a MatrixBase reference? I do not get what really happens behind the scenes. An example function code would be: #include #include using namspace Eigen; template…
OnurA
  • 611
  • 2
  • 11
  • 25
4
votes
1 answer

How to ensure Eigen isometry stays isometric?

I am currently looking into Eigen::Isometry3f, defined as typedef Transform 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…
Thomas
  • 725
  • 4
  • 14
4
votes
2 answers

c++ Eigen3 matrix strange behaviour

I'm trying to get a random symmetric matrix with linear algebra c++ library Eigen3. I'm doing it like this: Eigen::MatrixXd m(3, 3); m.setRandom(); m = 0.5 * (m + m.transpose()); But the reasult is totally wrong. But if I won't rewrite the m…
PG_LoLo
  • 179
  • 10
4
votes
1 answer

Convert an Eigen::TensorMap to Eigen::Tensor

It's possible to convert an Eigen::Map to a Matrix by assignment: vector v = { 1, 2, 3, 4 }; auto m_map = Eigen::Map>(&v[0]); Eigen::MatrixXf m = m_map; cout << m << endl; This produces: 1 2 3…
Joe Antognini
  • 233
  • 2
  • 8
4
votes
1 answer

Eigen - Balancing matrix for eigenvalue

My experience (like some others: How do I get specified Eigenvectors from the generalized Schur factorization of a matrix pair using LAPACK?) is that the eigenvalues obtained from Eigen (I don't care about the eigenvectors) are not nearly as…
ibell
  • 1,070
  • 8
  • 29
4
votes
1 answer

Eigen C++ Library gives error with C++ 11 option

I have the following C++ code where I used Eigen C++ Library. #include "Dense" #include int main() { Eigen::MatrixXf x(10,10); x.setRandom(); std::cout<<"x is ..\n"<
Soo
  • 885
  • 7
  • 26
4
votes
1 answer

Are there any documents for Eigen/CXX11?

I would like to add a new Op to TensorFlow. I find that most Ops in TF are implemented using the tensor operations implemented in ``third_party/eigen3/unsupported/Eigen/CXX11/Tensor'', which seems to be independent of the original Eigen library. Are…
bgshi
  • 1,174
  • 2
  • 12
  • 14
4
votes
2 answers

Eigen matrix library coefficient-wise modulo operation

In one of the functions in the project I am working on, I need to find the remainder of each element of my eigen library matrix when divided by a given number. Here is the Matlab equivalent to what I want to do: mod(X,num) where X is the dividend…
pincir
  • 345
  • 1
  • 3
  • 7
4
votes
1 answer

How do you use the BandMatrix class in Eigen?

I'm writing some numerical code in C++ and chose to use the Eigen library. One of the reasons for this that it seems to support band matrices. The only info I've been able to find is this file…
user674155
4
votes
2 answers

how to use Eigen for B-Splines for noisy sequence data

In the below picture, the spap2 function is used in Matlab to smooth noisy data. The result is very good. Eigen library supports this functionality Splines. I'm looking for an example in Eigen to obtain similar results. For the Matlab, I've used…
CroCo
  • 5,531
  • 9
  • 56
  • 88