# Questions tagged [eigen]

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

47 questions
Filter by
Sorted by
Tagged with
191 views

### Speeding up 3 body problem acceleration calculation

I want to find optimizations to my code for the 3BP, and more specifically computing accelerations. I'm using a data-driven approach, so I have a bodies structure ...
• 41
1 vote
156 views

### Can Spectra find eigenvectors and eigenvalues of complex-valued matrices?

I am using Spectra to iteratively solve large-scale eigenvalue problems. I like it because it readily works on windows, and is header-only. I would like to know if it supports complex-valued matrices. ...
• 417
1 vote
66 views

### How can I optimize the solution of linear systems in my Finite Element Method code for solving nonlinear computational mechanics problems?

Currently, I use Eigen3 for linear algebra operations on sparse matrices and either UMFPACK or CHOLMOD from SuiteSparse to solve sparse linear systems. However, as my model grows larger and the need ...
60 views

### How best to iterate over three dimensional grid?

My problem is to iterate through $[0.95,1] \times [0.95,1] \times[0.95,1] \in \mathbb{R}^{3}$. Is there a generic way to do this? I was considering rolling it all out and effectively vectorising the ...
155 views

### Numerical integration library interfacing with eigen

I am looking for a numerical integration library like this one. The examples look very appealing but I see that all test functions use very barebones C arrays. Do you have any recommendations of ...
669 views

### How to initialize Eigen C++ parameters within for-loop? [closed]

I am new to Eigen C++ programming. I am trying to create an Rcpp function to call from R. The function takes a list of matrices (Xlst), and two lists of vectors (ylst and smwlst). In each for-loop ...
3k views

### Dynamic Sized Identity Matrix in Eigen

I am aware of creating an identity matrix in Eigen if the number of rows and columns are known. How do we create them dynamically when the size is not known? An example would be useful. Thanks.
1 vote
989 views

### Symmetric Matrix in Eigen C++

I am aware of a symmetric matrix type in uBLAS as ublas::symmetric_matrix matrix. Is there an equivalent for this in Eigen library that can be used to construct one or do we need to explicitly check ...
3k views

### Eigen C++ Library Over 4x Slower than Fortran

I am experimenting with ways to call compiled programs from Python. My primary interest is iterative optimization methods, so I'm testing an implementation of Newton's method to solve a logistic ...
5k views

### C++ Eigen::Map class questions

The Eigen::Map documentation here (https://eigen.tuxfamily.org/dox/classEigen_1_1Map.html) mentions the following: This class represents a matrix or vector expression mapping an existing array of data....
• 11
1 vote
321 views

### Why does Eigen allocate a temporary to evaluate A.noalias() = B.transpose()*C in parallel?

I wrote a program which iteratively transforms data using matrix multiplications. To minimize the number of large memory allocations, I use two roughly equal-sized ...
274 views

### Matlab - Compute approximative common eigenvectors basis between two matrices as a function of tolerance

I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as : ...
44 views

### In Eigen, can a sparse matrix contain vectors/objects instead of simple scalar values?

I need to have a sparse matrix whose elements are not simple numbers, but objects, e.g. a couple of floating point values and a bunch of integer indices. I am wondering if Eigen has something similar, ...
• 171
1 vote
312 views

### Range of a matrix from its complete orthogonal decomposition

In this StackOverflow answer, @Gokul has shown how to get a basis of the kernel of a matrix with the help of the 'Eigen' function CompleteOrthogonalDecomposition. ...
1 vote
456 views

### Optimize speed for calculating the approximate inverse of a large matrix

I am searching for a faster method to calculate an approximate inverse of a large matrix (up to 32000x32000) resulting from a discrete non-linear system of partial differential equations. I'm using C++...
• 11
2k views

### 'Eigen' matrices with static dimension

I noticed that 'Eigen' matrices with dynamic dimension are less efficient than the matrices with static dimension. My algorithm uses a lot of matrices which don't need to be resized, so I wanted to ...
280 views

1 vote
2k views

### How can I reuse the SVD of matrix A to solve LS problems for both A and its transpose via Eigen C++?

If $A\in R^{m\times n}, b\in R^m, c\in R^n$, if I need to solve the least square problems via SVD of $A$ and $A^T$, i.e. I need to solve the least square solutions to following linear systems via ...
508 views

### What is the most efficient way to obtain the max eigenvalue of a specific symmetric matrix via Eigen C++

Suppose I have a symmetric matrix $A_{1000\times 1000}$, which can be represented by: $A = J G J^T$ where $J$ in 1000x3 is full column rank dense matrix; $G$ in 3x3 is a nonsingular dense matrix. ...
157 views

### How can I efficiently position the different segments of a large vector in Eigen C++?

I have a very large(up to 9 000 000) VectorXi vector defined in Eigen C++ which is read from a data file. The vector consists of 0, 1, 2, ...n segments with ...
678 views

### How to implement the spectral decomposition of a symmetric dense matrix via Eigen C++

Spectral decomposition of symmetric matrix $A_{n\times n}$, specifically, $n=3$ find the orthogonal matrix $Q$ and diagonal matrix $\Lambda$ such that: $A=Q\Lambda Q^T$ How to implement such ...
1k views

### How to re-use the coefficient matrix decomposition result when solving linear systems by Eigen C++

My problem needs to solve dense symmetric linear systems something like: A x = b, A y = x, ...
1 vote
355 views

### Is there congruent transform implementation for dense symmetric matrix in Eigen(C++)?

I need to determine whether a real dense symmetric matrix is positive definite or not. One possible way is to obtain all the eigen values and check the sign of the minimum eigen value but requires ...
5k views

### How to change the dimensions of an Eigen Matrix in a loop?

I have a while loop, in which I use a Matrix A, vectors B and x with varying dimensions: <...
1k views

### Why SVD is talk about less than QR and LU for sparse matrix?

For example the C++ sparse matrix libraries I used -- Eigen and SuiteSparse, they seem not to have any SVD funcitionality for sparse matrix. So just curious, is SVD more difficult than QR/LU for ...
• 211
4k views

### Symmetric Matrix Computation (Eigen & C++)

I want to compute a symmetric matrix A from a vector b by: A = b * b'. Does the Eigen library automatically take into account that it does not need to do all calculations to get A (because of the ...
283 views

### Why do I get “estimated error” -1.#IND when doing BICGSTAB linear solver using ILUT perconditioner in eigen

I'm using Eigen (a C++ library for numerical linear algebra) to solve a linear equation with the the bi-conjugate gradient BICGSTAB algorithm with Incomplete LU preconditioner. However, the result <...
• 169
### $\mathbf{UDU}^\top$ decomposition routines in LAPACK/Eigen?
I would like to compute the decomposition of a real symmetric positive definite matrix $\mathbf{A} = \mathbf{UDU}^\top$. LINPACK seems to have it as DSIFA, but I ...