eigen3

Identifying temporary object creation in Eigen

半腔热情 提交于 2021-02-19 06:51:42
问题 As the documentation in Eigen C++ library points out at many places, to get the maximum performance in terms of the computation time, we need to avoid temporary objects as far as possible. In my application, I deals with Dynamic size matrices. I would like to know the creation of temporary matrices in my calculations. Is there any general method to identify the creation of the temporary matrices? For example, Eigen::MatrixXf B, C, D; ....some initialization for B, C, D Eigen::MatrixXf A = B*C

Error while compiling eigen program: error: 'seq' is not a member of 'Eigen'

隐身守侯 提交于 2021-02-08 13:25:27
问题 I am trying to index a matrix in indexes which follow an arithmetic sequence. According to the Eigen tutorial on the official website, I should use Eigen::seq(firstVal, lastVal, step) to generate this sequence. After calling this the error, as pasted in the title of this thread pops up. I checked all the files of my local eigen folder, for the 'seq' method, but no luck. It wasn't anywhere. I guess this means that some file is missing, right? Code goes smth like this. Headers at the top

Avoiding dynamic memory allocation on factorizing sparse matrix with Eigen

南楼画角 提交于 2021-01-29 05:11:17
问题 In my application I need to avoid dynamic memory allocation (malloc like) except in the class constructors. I have a sparse semidefinite matrix M whose elements change during the program execution but it mantains a fixed sparsity pattern. In order to solve many linear systems M * x = b as fast as possible, the idea is to use inplace decomposition in my class constructor as described in Inplace matrix decompositions, then call factorize method whenever M changes: struct MyClass { private:

Avoiding dynamic memory allocation on factorizing sparse matrix with Eigen

一笑奈何 提交于 2021-01-29 05:06:59
问题 In my application I need to avoid dynamic memory allocation (malloc like) except in the class constructors. I have a sparse semidefinite matrix M whose elements change during the program execution but it mantains a fixed sparsity pattern. In order to solve many linear systems M * x = b as fast as possible, the idea is to use inplace decomposition in my class constructor as described in Inplace matrix decompositions, then call factorize method whenever M changes: struct MyClass { private:

Eigen vertical stacking rows into Matrix

蹲街弑〆低调 提交于 2021-01-28 05:47:15
问题 I would like to create a matrix of size 2N x 9 where N is a dynamic value by vertical stacking 2N 1x9 matrices. Here's what I tried doing. using CoefficientMatrix = Eigen::Matrix<T, Eigen::Dynamic, 9>; using CoefficientRow = Eigen::Matrix<T, 1, 9>; CoefficientMatrix A(2*N, 9); for (int i = 0; i < N; i++) { CoefficientRow ax; CoefficientRow ay; // fill in ax and ay A << ax, ay; } But, I get the following runtime error. Assertion failed: (((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr

Implementing the Bartels–Stewart algorithm in Eigen3?

旧时模样 提交于 2021-01-03 10:28:19
问题 In the past when I've needed to solve the Sylvester equation, AX + XB = C , I've used scipy 's function, solve_sylvester [1], which apparently works by using the Bartels-Stewart algorithm to get things into upper triangular form, and then solving the equation using lapack . I now need to solve the equation using eigen . eigen provides an function, matrix_function_solve_triangular_sylvester [2], which seems by the documentation to be similar to the lapack function which scipy calls. I'm

Implementing the Bartels–Stewart algorithm in Eigen3?

牧云@^-^@ 提交于 2021-01-03 10:02:14
问题 In the past when I've needed to solve the Sylvester equation, AX + XB = C , I've used scipy 's function, solve_sylvester [1], which apparently works by using the Bartels-Stewart algorithm to get things into upper triangular form, and then solving the equation using lapack . I now need to solve the equation using eigen . eigen provides an function, matrix_function_solve_triangular_sylvester [2], which seems by the documentation to be similar to the lapack function which scipy calls. I'm

Implementing the Bartels–Stewart algorithm in Eigen3?

被刻印的时光 ゝ 提交于 2021-01-03 10:01:31
问题 In the past when I've needed to solve the Sylvester equation, AX + XB = C , I've used scipy 's function, solve_sylvester [1], which apparently works by using the Bartels-Stewart algorithm to get things into upper triangular form, and then solving the equation using lapack . I now need to solve the equation using eigen . eigen provides an function, matrix_function_solve_triangular_sylvester [2], which seems by the documentation to be similar to the lapack function which scipy calls. I'm

Implementing the Bartels–Stewart algorithm in Eigen3?

大憨熊 提交于 2021-01-03 09:57:00
问题 In the past when I've needed to solve the Sylvester equation, AX + XB = C , I've used scipy 's function, solve_sylvester [1], which apparently works by using the Bartels-Stewart algorithm to get things into upper triangular form, and then solving the equation using lapack . I now need to solve the equation using eigen . eigen provides an function, matrix_function_solve_triangular_sylvester [2], which seems by the documentation to be similar to the lapack function which scipy calls. I'm

Workaround for resizing Eigen::Ref

痴心易碎 提交于 2020-12-13 11:07:27
问题 I want to use Eigen::Ref to have non-template functions using Eigen::Matrix arguments. My problem is that in these functions, I may have to resize the matrices referenced by the Eigen::Ref. I understand that for generality an Eigen::Ref should not be resized because it can map to an expression or a matrix block, but In my case, I am sure that what is behind my Eigen::Ref is an Eigen::Matrix. To illustrate this: #include "Eigen/Dense" void add(Eigen::Ref<Eigen::MatrixXd> M, const Eigen::Ref