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

"reshape()" function in Eigen tensor does not compile

I want to use "reshape()" fuction in Eigen unsupported tensor, but my source code cannot be compiled. The compilation was done as follows. g++ -std=c++14 -I (path to Eigen) eigen_practice.cpp -o eigen_practice and here is my source code. # include…
Hamcatu
  • 11
  • 1
1
vote
0 answers

Customization points in Eigen library

I am trying to implement a matrix-free function to use with conjugate gradient in Eigen. My matrix function is basically an application of several matrices consecutively to a vector so I prefer to implement my own matrix object and do this…
jjcasmar
  • 1,387
  • 1
  • 18
  • 30
1
vote
1 answer

Eigen: Map real and imag MatrixXd to MatrixXcd

I am working with some large data set where the real and imag part of a complex matrix is stored separately in a file, and I would like to create a Eigen::MatrixXcd from such data: // read data, note that real and imag data are stored separately …
Jerry Ma
  • 511
  • 4
  • 15
1
vote
1 answer

error C2039: 'binder2nd': is not a member of 'std' - Compiler Error with Eigen

I became the following Error during the Compile with (Debug/x64) in Visual Studio. 1>c:\users\ui\desktop\eigen-eigen-323c052e1731\eigen\src/Core/functors/StlFunctors.h(78): error C2039: 'binder2nd': is not a member of 'std' 1> …
user10788672
1
vote
1 answer

User defined Eigen function using twice as much memory as expected

I have defined the following function (MWE) (Note the formulation is an adaption of this formulation: How to Build a Distance Matrix without a Loop (Vectorization)?, as well as…
Aerys.L
  • 59
  • 2
  • 8
1
vote
1 answer

Dynamic eigen declaration types using templates

I am writing a simple program to define systems that has vectors representing the states. I would like to have a declaration type of the vector of Eigen depending on the number of states in the derived class. I tried to achieve this using templates…
rsvar67
  • 77
  • 8
1
vote
1 answer

Convert vector of dynamic Eigen vectors to bytes

I have a function to convert static Eigen vectors to a vector of bytes: template static std::vector toBytes(std::vector> const & vectors) { std::vector bytes; uint8_t const *…
Jerome Reinländer
  • 1,227
  • 1
  • 10
  • 26
1
vote
1 answer

Multi-Threading in Eigen (OpenMP is not used)

I have a problem in using multi-threading in Eigen library. This is my code: #include #include #include "Eigen/Core" #include using namespace Eigen; int main(int argc, char *argv[]) { QCoreApplication…
Nima Ghorab
  • 309
  • 1
  • 3
  • 13
1
vote
0 answers

std::vector allocated memory but fails to access its elements

I created a vector which contains 100 Eigen::Matrix4f. But when I use transforms[i] to access its elements, the programme shows "core dumped: segmentation fault". When I use push_back() function to initialize it, it works well. I checked the size of…
fyl
  • 11
  • 5
1
vote
1 answer

Eigen: Compare two sparse matrix with probably different sparsity pattern

I want to compare two Eigen::SparseMatrix There are exists res.isApprox(ans) method but unfortunately it fail with assertion in case of different sparsity pattern, as far as i know AffineInvariantDeformerTest01:…
Daiver
  • 1,488
  • 3
  • 18
  • 47
1
vote
2 answers

Map BGR OpenCV Mat to Eigen Tensor

I'm trying to convert an OpenCV 3-channel Mat to a 3D Eigen Tensor. So far, I can convert 1-channel grayscale Mat by: cv::Mat mat = cv::imread("/image/path.png", cv::IMREAD_GRAYSCALE); Eigen::MatrixXd myMatrix; cv::cv2eigen(mat,…
Gal Sight
  • 13
  • 4
1
vote
1 answer

Broadcasting (two) vectors in Eigen C++

Suppose I have an input ArrayXd of size 3: P[1] P[2] P[3] My required symmetric MatrixXd is of size [3,3]: -P[1]*P[1]+P[1] -P[2]*P[1] -P[3]*P[1] -P[1]*P[2] -P[2]*P[2]+P[2]…
Marzz
  • 49
  • 6
1
vote
0 answers

Eigen library matrix alignment error when running code on the Raspberry Pi but not in Linux

I'm writing some c++ code to be run on a Raspberry Pi, using the Eigen library to work with my arrays and matrices. The code I wrote works on Linux, but when I run it on the Raspberry Pi it throws this error: Eigen::internal::matrix_array
1
vote
1 answer

Eigen + gmp looks for gmp_expr not mpq_class

I am unfamiliar with templates and C++ generally but want to get into using Eigen with gmp. I followed the Eigen tutorial on custom types and want to output to the terminal. I get a compilation error that makes reference to …
1
vote
1 answer

Efficient way of sorting eigenvalues and eigenvectors obtained from Eigen

I am using Eigen in order to solve the eigensystem for a symmetric matrix m, an example given as follows: #include #include #include using namespace std; using namespace Eigen; int main() { Matrix3f…
user929304
  • 465
  • 1
  • 5
  • 21