Questions tagged [eigen]

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

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

Despite its name, this tag should not be mistaken with the and ones.

Eigen covers a large set of features through an easy to use unified API. Here is quick and incomplete overview:

  • Dense algebra:
    • array/matrix manipulation
    • linear solvers and factorizations (Cholesky, LU, QR, SVD, EVD)
  • Sparse algebra:
    • compressed sparse representation
    • direct solvers and factorizations (Cholesky, LU, QR)
    • Krylov subspace methods (CG, BiCGSTAB, GMRES) with preconditioners (Jacobi, ILLT, ILUT)
  • Geometry:
    • space transformation and subspace primitives

Find more on Eigen's home page and its online documentation.

3438 questions
1
vote
1 answer

Eigen custom classes and function parameters

I'm trying to replace a matrix library currently used in my code using Eigen. I've got several classes like this one adding custom methods to base matrix class. In this example I replaced the father class with Eigen: #include #include…
greywolf82
  • 21,813
  • 18
  • 54
  • 108
1
vote
1 answer

How to assign the complex conjugate of the upper triangular matrix to the lower triangular matrix with Eigen

I have a square Eigen::MatrixXcd x that has complex values assigned to the upper triangular part including the diagonal axis and some random values assigned to the lower triangular part like that (4x4 example): X00 X01 X02 X03 X10 X11 X12 …
PluginPenguin
  • 1,576
  • 11
  • 25
1
vote
0 answers

Trouble setting up eigen with clion

I am attempting to set up eigen with clion and I cannot solve my errors. All solutions I've found online do not work for my case. I modified the cmake list based on a solution I found on this website Error with Clion/Cmake and Eigen and I get this…
Denis
  • 11
  • 1
1
vote
1 answer

eigen eulerAngles() returns incorrect values

I try to extract euler angles from eigen 3x3 rotation matrix. However the values I got from eulerAngles() method seems not correct. I wrote a small test code and I've got the strange results. The code is belows. #include #include…
Gil-Dong Hong
  • 13
  • 1
  • 5
1
vote
1 answer

How to use a vector as index in eigen

In matlab, we can use a vector B to get the sublist of vector A by coding like A(B). But in Eigen, I am wondering if there is anyway to do that?
Y. Wang
  • 11
  • 1
1
vote
3 answers

Eigen: how to convert the result of "greater than" (on ArrayXf) to Eigen vector

Consider the following code: Eigen::VectorXf classify() { Eigen::VectorXf probability(4); probability << 0.9, 0.8, -0.1, 0.2; auto y_pred = probability.array() > 0.8; //what is the type of y_pred? //y_pred looks like [1 0 0 0] //…
Gaetan
  • 577
  • 2
  • 7
  • 20
1
vote
2 answers

Eigen indexing, update all column of a specific row

Let say I have an ArrayXXf (or MatrixXf) m. In each iteration of a for loop, I want to fill m row-wise with a VectorXf. Eigen::ArrayXXf m(5, 5); for (int i = 0; i < 5; i++) { Eigen::VectorXf vec(5); vec << i, i + 1, i + 2, i+3, i+4; …
Gaetan
  • 577
  • 2
  • 7
  • 20
1
vote
0 answers

Eigen read and write LLT factorization to file

Let's say I have a matrix MatrixXd A and its LLT factorization: LLT llt(A); How can I save the factorization result to a file and load it later, so that we don't need to do the factorization again in the future runs? I know we can obtain…
hklel
  • 1,624
  • 23
  • 45
1
vote
0 answers

Type trait to check if an Eigen type is an expression (without storage) or a Matrix or Array (with storage)?

I am trying to distinguish the two types of Eigen types using some template magic. types that are specialization of Matrix or Array, such as MatrixXd, VectorXd, etc. These types has its own data storage. types that are expression, i.e.…
Jerry Ma
  • 511
  • 4
  • 15
1
vote
1 answer

eigen create super/sub diagonal matrix

How would one create a matrix with elements along any specified diagonal without looping? A toy example would be specifying a 3x3 matrix of ones and setting the indices to -1,0,1 and getting a full matrix that looked like: 1 1 0 1 1 …
debo
  • 372
  • 2
  • 11
1
vote
1 answer

How can Boost Program_Options handle vector of arrays?

In my program, I need to perform some transformations uing the Eigen library. As I am using a config file for the user to ajust some settings, I am searching for a way to integrate the transformations in this config file. I came up with the…
shup
  • 120
  • 1
  • 16
1
vote
1 answer

Rotate a std::vector as a rigid transformation?

I have a few 3d points, stored in a std::vector. I need to rigidly rotate and translate these points, without changing their relationship to one another. As if moving the cloud as a whole. Based on this…
anti
  • 3,011
  • 7
  • 36
  • 86
1
vote
1 answer

different behavior for eigen::matrix inversion when compiled with gcc and nvcc

I do matrix inversion(code provided below) using Eigen(Lets call it inversion.cpp). Inversion.cpp compiles with g++ and gives correct inverse. Now I change the code name to Inversion.cu and try to compile with nvcc. The compile fails with a long…
user27665
  • 673
  • 7
  • 27
1
vote
1 answer

Overload Eigen::MatrixBase

I have a function for which I have several templated overloads. I which to add an Eigen overload to it. I want to be general such as to be able to accept any Eigen matrix. Therefore I use Eigen::MatrixBase. The problem kicks in with the overload,…
Tom de Geus
  • 5,625
  • 2
  • 33
  • 77
1
vote
1 answer

Eigen non constant MatrixReplacement for sparse solver

I want to use matrix free sparse solvers with custom matrix-vector product object. Here is great example how to to it - https://eigen.tuxfamily.org/dox/group__MatrixfreeSolverExample.html But in this example custom matrix-product object should be…
Daiver
  • 1,488
  • 3
  • 18
  • 47
1 2 3
99
100