eigen

How to compile Eigen in iPhone

谁说胖子不能爱 提交于 2019-12-23 22:24:06
问题 I want to compile Eigen and use it in iPhone with NEON features. How to compile Eigen in iPhone? Do In need to compile for specific ARM chip? And do I need to modify build script? Cheers. 回答1: Since explicit vectorization for ARM NEON is supported out of the box in recent versions of Eigen I'm guessing you shouldn't have to do anything special at all. The section on installation in the manual reads: In order to use Eigen, you just need to download and extract Eigen's source code (see the wiki

Eigen: Replicate (broadcast) by rows

谁说胖子不能爱 提交于 2019-12-23 21:24:23
问题 I'd like to replicate each row of a matrix M without any copy occurring (i.e. by creating a view): 0 1 0 1 2 3 -> 0 1 2 3 2 3 M.rowwise().replicate(n) is a shorcut for M.replicate(1,n) which seems kind of useless. The following snippet does a copy, and cannot work if M is an expression. Eigen::Index rowFactor = 2; Eigen::MatrixXi M2 = Eigen::Map(M.data(), 1, M.size()).replicate(rowFactor, 1); M2.resize(M.rows()*rowFactor, M.cols()) ; In some situation, I may use the intermediate view Eigen:

How do I get specified Eigenvectors from the generalized Schur factorization of a matrix pair using LAPACK?

假装没事ソ 提交于 2019-12-23 18:12:06
问题 I am grad student trying to rewrite my MATLAB prototype code into C++ code using Eigen and LAPACK. Generalised eigenvalue solver (A*x=lamba*B*x) takes some part in this program. Because Eigen's generalised eigen solver could result in wrong eigenvalue (in my experience), I decided to go with LAPACK (using Accelerate framework in OS X) The code below is the C++ translation of tgevc example http://www.nag.com/numeric/fl/manual/pdf/F08/f08ykf.pdf that I wrote. Everything looks fine unless I

How to get rank of a matrix in Eigen library?

佐手、 提交于 2019-12-23 16:42:25
问题 How to get rank of a matrix in eigen? 回答1: You need to convert your matrix to a rank-revealing decomposition. For instance FullPivLU . If you have a matrix3f it looks like this : FullPivLU<Matrix3f> lu_decomp(your_matrix); auto rank = lu_decomp.rank(); Edit Decomposing the matrix is the most common way to get the rank. Although, LU is not the most reliable way to achieve it for floating values as explained on the rank article on wikipedia When applied to floating point computations on

Re-use Eigen::SimplicialLLT's symbolic decomposition

為{幸葍}努か 提交于 2019-12-23 16:13:49
问题 I am struggling a bit with the API of the Eigen Library, namely the SimplicialLLT class for Cholesky factorization of sparse matrices. I have three matrices that I need to factor and later use to solve many equation systems (changing only the right side) - therefore I would like to factor these matrices only once and then just re-use them. Moreover, they all have the same sparcity pattern, so I would like to do the symbolic decomposition only once and then use it for the numerical

Can I use Eigen sparse matrices for general storage requirements

柔情痞子 提交于 2019-12-23 15:11:23
问题 I need a templated sparse matrix implementation but only to reduce memory footprint, not do any numerical solving. So I tried to use Eigen, even though I don't need the math part. Why ? It just happened to be lying on my machine, and I already had used it a little for other stuff. But I am surely no Eigen expert! Context : I have a type T (say struct T{int a; float b; vector<int> c; }; and I need to store large matrices of this (say more than 1000x1000) and most of the values are null

c++: Eigen Library newbie sort

橙三吉。 提交于 2019-12-23 13:04:34
问题 I can't for the life of me work out why this isn't working correctly. It doesn't seem to return the kth element. typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> matrix; double test(matrix& D, int k) { auto d = D.row(1); std::nth_element(d.data(),d.data()+k, d.data()+d.size()); return d(k) ; } I have also tried template <typename ScalarType, typename Derived> void Sort(Eigen::MatrixBase<Derived> &xValues) { std::sort(xValues.derived().data(), xValues.derived().data()+xValues

eigen: Subtracting a scalar from a vector

拜拜、爱过 提交于 2019-12-23 08:06:10
问题 I am having an error when using the Eigen library and all I am trying to do is subtract a scalar from an Eigen::VectorXf. So, my code is something as follows: #define VECTOR_TYPE Eigen::VectorXf #define MATRIX_TYPE Eigen::MatrixXf // myMat is of MATRIX_TYPE JacobiSVD<MATRIX_TYPE> jacobi_svd(myMat,ComputeThinU | ComputeThinV); const float offset = 3.0f; VECTOR_TYPE singular_values = jacobi_svd.singularValues(); VECTOR_TYPE test = singular_values - offset; The last line results in a compilation

eigen: Subtracting a scalar from a vector

↘锁芯ラ 提交于 2019-12-23 08:06:04
问题 I am having an error when using the Eigen library and all I am trying to do is subtract a scalar from an Eigen::VectorXf. So, my code is something as follows: #define VECTOR_TYPE Eigen::VectorXf #define MATRIX_TYPE Eigen::MatrixXf // myMat is of MATRIX_TYPE JacobiSVD<MATRIX_TYPE> jacobi_svd(myMat,ComputeThinU | ComputeThinV); const float offset = 3.0f; VECTOR_TYPE singular_values = jacobi_svd.singularValues(); VECTOR_TYPE test = singular_values - offset; The last line results in a compilation

Eigen efficient type for dense symmetric matrix

余生长醉 提交于 2019-12-23 06:55:15
问题 Does Eigen have efficient type for store dense, fixed-size, symmetric matrix? (hey, they are ubiquitous!) I.e. for N=9, it should store only (1+9)*9/2==45 elements and it has appropriate operations. For instance there should be efficient addition of two symmetric matrices, which returns simmilar symmetric matrix. If there is no such thing, which actions (looks like this) I should make to introduce such type to Eigen? Does it has concepts of "Views"? Can I write something like "matrix view"