eigen

How to use custom preconditioner with Eigen

女生的网名这么多〃 提交于 2019-12-12 05:18:08
问题 I am trying to use a custom preconditioner for an iterative solver (CG for instance) with Eigen. Specifically, I have to solve a similar problem multiple times: the matrix changes slightly but stays close to a mean matrix. I would like to compute a Cholesky decomposition of my mean matrix and then use this as a preconditioner. What I had in mind is something like: ConjugateGradient< SparseMatrix<double>, Lower, CholmodSupernodalLLT<SparseMatrix<double>> > solver(meanMatrix); solver

Eigen fixed-size matrices in shared memory using boost interprocess

喜欢而已 提交于 2019-12-12 04:55:55
问题 I like to place Eigen fixed-size matrices into the shared memory. But on execution I am getting the following error: /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:78: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = double; int Size = 2; int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(eigen_unaligned_array_assert_workaround_gcc47(array)) & 0xf) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel

Eigen: Modifyable Custom Expression

北慕城南 提交于 2019-12-12 04:54:21
问题 I'm trying to implement a modifyable custom expression using Eigen, similar to this question. Basically, what I want is something similar to the indexing example in the tutorial, but with the possibility to assign new values to the selected coefficients. As suggested in the accepted answer in the question mentioned above, I have looked into the Transpose implementation and tried many things, yet without success. Basically, my attempts are failing with errors like 'Eigen::internal::evaluator

Polymorphic wrapper around matrix/linear algebra libraries - C++, starting with Eigen

喜你入骨 提交于 2019-12-12 04:46:59
问题 I am writing a custom C++ numerical library that relies heavily on linear algebra routines. I am also using Eigen to cater for the actual matrix operations. I want to decouple my library from the Eigen implementation so that it is unaware of Eigen. This will allow me to keep Eigen references in one place and make it easy to change the linear algebra library to another implementation in the near future. In java, this would be relatively simple. However I am running into difficulties with Eigen

Weird Behavior when using Eigen

拈花ヽ惹草 提交于 2019-12-12 04:43:44
问题 I am writing a wrapper to Eigen for my personal use and I encountered the following weird behavior: void get_QR(MatrixXd A, MatrixXd& Q, MatrixXd& R) { HouseholderQR<MatrixXd> qr(A); Q = qr.householderQ()*(MatrixXd::Identity(A.rows(),A.cols())); R = qr.matrixQR().block(0,0,A.cols(),A.cols()).triangularView<Upper>(); } void get_QR(double* A, int m, int n, double*& Q, double*& R) { // Maps the double to MatrixXd. Map<MatrixXd> A_E(A, m, n); // Obtains the QR of A_E. MatrixXd Q_E, R_E; get_QR(A

Modifying values of nullary-expressions using Eigen

五迷三道 提交于 2019-12-12 04:29:43
问题 I do want to write a custom nullary-expression in Eigen3, which is modifyable. As described in the Eigen documentation it seems like nullary-expression are not modifiable. Is there an easy way to get something like a modifyable custom nullary-expression? I would like to use it to write a custom data wrapper. 回答1: Nullary-expressions are indeed read-only. For read-write expressions, you currently has to write your own expression. To this end you can start with this tutorial and take

does eigen have self transpose multiply optimization like H.transpose()*H

末鹿安然 提交于 2019-12-12 04:28:09
问题 I have browsed the tutorial of eigen at https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixArithmetic.html it said "Note: for BLAS users worried about performance, expressions such as c.noalias() -= 2 * a.adjoint() * b; are fully optimized and trigger a single gemm-like function call." but how about computation like H.transpose() * H , because it's result is a symmetric matrix so it should only need half time as normal A*B, but in my test, H.transpose() * H spend same time as H

icpc debug info with Eigen library

两盒软妹~` 提交于 2019-12-12 03:03:32
问题 Eigen is a popular C++ library, but icpc seems to have a problem generating debugging info from code that uses Eigen. I'm using the compiler icpc version 13.1.1. I checked with both Eigen 3.2.8 and 3.1.3. It's going to be hard to recompile all the libraries I need with another compiler, so does anyone see a good solution to get Eigen to work with a debugger? The problem is that variable values don't always get updated in the debugger. Here is main.cpp #include "stdio.h" #include "/home

Eigen and parallellization makes no difference for conjugate gradient. Precondition also fails

故事扮演 提交于 2019-12-12 02:33:36
问题 This is related to this question. I have today experimented a bit with Conjugate Gradient, in particular I experimented with max_iterations and tolerance . It is faster but not fast enough. According to the documentation it should be enough to add -fopenmp in the compilation to enable multi-threading . I have tested using both `omp_set_num_threads(nbrThreads); Eigen::setNbThreads(nbrThreads);` It makes no difference in time if I use 5 threads or 1 thread, and that I think is a bit strange.

Submatrix view from indices in Eigen

假装没事ソ 提交于 2019-12-12 01:55:31
问题 Is it possible in Eigen to do the equivalent of the following operation in Matlab? A=rand(10,10); indices = [2,5,6,8,9]; B=A(indices,indices) I want to have a submatrix as a view on the original matrix with given, non consecutive indices. The best option would be to have a shared memory view of the original matrix, is this possible? I've figured out a method that works but is not very fast, since it involves non vectorized for loops: MatrixXi slice(const MatrixXi &A, const std::set<int>