eigen

Eigen segfault no optimizations Solaris

≡放荡痞女 提交于 2020-01-06 14:12:56
问题 I have the following code: #include <Eigen/Dense> struct States { // Eigen::VectorXd v; Eigen::VectorXd v{Eigen::VectorXd::Ones(2)}; States() { // v.resize(2); // v << 1, 1; } }; States st; int main() {} Whenever I build the project under Solaris 11 (with g++4.9), with no optimizations, I get a segfault (core dumped) when running. After some digging and step-by-step debugging I think the faulty line is in DenseCoeffBase.h , inside function copyPacket , namely the line 537 derived().template

Eigen3 select rows out based on column conditions

£可爱£侵袭症+ 提交于 2020-01-06 06:57:44
问题 I have a matrix in eigen which is 2 dimensions, such as: 122 443 544 456 0.9 324 435 5465 645 0.8 32 434 545 546 0.778 435 546 6565 656 0.6878 546 6565 656 3453 54 0.7788 5456 546 545 6565 3434 0.244 435 5456 656 656 6565 0.445 ..... I want select all rows (or get it's row index out) when the last column value bigger than 0.3. I know I can do this by iteration all rows and judge the last element, but I have maybe 10000 rows, to do this, iteration will be very slow. Does there any better way

Eigen - Levenberg Marquardt algorithm: invalid template arguments on definition of permutation

孤街浪徒 提交于 2020-01-06 04:32:31
问题 I'm trying to use the Eigen implementation of Levenberg Marquardt algorithm on a Android application. In order to use Eigen, I'm using Android NDK and jni. I've already tested Eigen with simple calculations (like matrix creation and vector sums) and it works perfectly. However, when I tried to use the Levenberg Marquardt algorithm I got some errors on the LevenbergMarquardt.h file from Eigen's library. First, here is my code. I based on this code: Eigen::MatrixXd matrix(count, 3); for (int i

How to avoid memory allocations in sparse expressions with Eigen

陌路散爱 提交于 2020-01-05 09:23:12
问题 I have an application where the sparsity pattern is constant. Lets say that my computations are in the form sm3 = sm1 + sm2 However, even I have set the sparsity pattern to be the same in all of those operands, my profiler shows that most of the time is spent in allocating and deallocating the result matrix. Here is my MWE: #include <eigen3/Eigen/Sparse> #include <iostream> int main(int argc, char *argv[]) { using namespace Eigen; SparseMatrix<double> sm1(2, 2), sm2(2, 2), sm3(2, 2); //

How to avoid memory allocations in sparse expressions with Eigen

可紊 提交于 2020-01-05 09:23:04
问题 I have an application where the sparsity pattern is constant. Lets say that my computations are in the form sm3 = sm1 + sm2 However, even I have set the sparsity pattern to be the same in all of those operands, my profiler shows that most of the time is spent in allocating and deallocating the result matrix. Here is my MWE: #include <eigen3/Eigen/Sparse> #include <iostream> int main(int argc, char *argv[]) { using namespace Eigen; SparseMatrix<double> sm1(2, 2), sm2(2, 2), sm3(2, 2); //

getting lnk2019 error when compile a program using qt creator and eigen library

半世苍凉 提交于 2020-01-05 05:27:10
问题 I try to compile a project in qt and after i link the necessary libs i ghet the fallowing linking error : labelbox.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall LabelImage::setAxis(class Eigen::Matrix<double,4,4,0,4,4>)" (?setAxis@LabelImage@@QAEXV?$Matrix@N$03$03$0A@$03$03@Eigen@@@Z) referenced in function "public: void __thiscall ImageView::setRotMat(class Eigen::Matrix<double,4,4,0,4,4> &)" (?setRotMat@ImageView@@QAEXAAV?$Matrix@N$03$03$0A@$03$03@Eigen@@@Z) If

Error with Clion/Cmake and Eigen

这一生的挚爱 提交于 2020-01-05 04:57:10
问题 I am trying to get Eigen up and running but I am running into a roadblock. I opened Clion and in the CMakeLists.txt tab I entered the following code. Please note I have installed Eigen with home-brew. project(untitled) cmake_minimum_required(VERSION 3.7) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package(Eigen3 REQUIRED) include_directories(EIGEN3_INCLUDE_DIR) set(SRCS main.cpp) add_executable(untitled ${SRCS}) I am getting the following error. /Applications/CLion.app/Contents

Concatenate sparse matrix Eigen

自作多情 提交于 2020-01-04 17:56:39
问题 I have two sparse matrices in Eigen, and I would like to join them vertically into one. As an example the target of the code would be: SparseMatrix<double> matrix1; matrix1.resize(10, 10); SparseMatrix<double> matrix2; matrix2.resize(5, 10); SparseMatrix<double> MATRIX_JOIN; MATRIX_JOIN.resize(15, 10); MATRIX_JOIN << matrix1, matrix2; I found some solutions on a forum however, I wasn't able to implement it. What's the proper way to join the matrices vertically? Edit My implementation:

No copy multiplication in Eigen

核能气质少年 提交于 2020-01-04 13:48:03
问题 I'm using Eigen with big matrices and I'm thinking about ways to optimize my code, focusing on reducing dynamic memory allocation. I'm trying to multiply two matrices. Those matrices change a little bit every now and then, but their sizes stay the same. I'd like to see the output of the multiplication going to a predefined matrix (that would have memory already allocated for it). So here's an example of what I'm doing: Eigen::MatrixXd left, right,result; // ... result = left * right; // ...

Eigen Sparse Matrix get Indices of Nonzero Elements

怎甘沉沦 提交于 2020-01-04 04:22:32
问题 I am using Eigen Sparse Matrices for the first time, and now I would like to know how to get the indices of the nonzero elements. I constructed my Sparse Matrix as follows: Eigen::SparseMatrix<Eigen::ColMajor> Am(3,3); and I can see some indices in VS by looking into the m_indices variable. But I can't access them. Can anyone please help me? For a Matrix like ( 1 0 1 0 1 1 0 0 0 ) I would like the indices to be like (0,0), (0,2), (1,1), (1,2) . Is there any way to do it? P.S. My matrices are