Category : eigen

I’ve been going through the Eigen documentation for using noalias to avoid unnecessary temporary allocations when doing Matrix-Matrix products, but I was wondering if it’s possible to use noalias in the following situation: Eigen::VectorXf x(3); x << 1, 2, 3; Eigen::MatrixXf A(3, 3); A << 1, 2, 3, 4, 5, 6, 7, 8, 9; // ..

Read more

I am trying to use the CppAD scalar type with Eigen. The following fails to compile: #include <Eigen/Dense> #include <cppad/cppad.hpp> #include <cppad/example/cppad_eigen.hpp> int main() { using Scalar = CppAD::AD<double>; //using Scalar = double; Eigen::Matrix<Scalar, 1,4> row; Eigen::Matrix<Scalar, 4,1> col; Scalar scalar = 5; Scalar res2 = row * col + scalar; //fails return 0; } ..

Read more

I tried to write my own method to save a Eigen::MatrixXd object in a textfile. However, the file is empty after running this method. While debugging, I saw that the file does not open as I want. Can anyone tell me why? #include<EigenDense> #include<iostream> #include<fstream> #include<string> using namespace std; void savematrix(Eigen::MatrixXd matrix, string filename) { ..

Read more

Let’s say I have 5 Coordinate systems A,B,C,D and W, represented on the following image (this is a view from the top): We know the following values: p_B_in_A: the position (as an Eigen::Vector3d) of B in A q_B_in_A: the orientation (as an Eigen::Quaterniond) of B in the A frame p_C_in_B: the position of C in ..

Read more

I am using the following struct in my project and the problem occurs in the second constructor. (I am using Visual Studio 2019.) struct optimal_subspace { vector<Eigen::VectorXd> span; //empty constructor optimal_subspace() {} //constructor taking a pointset, the cluster number i and the size of subspaces q //used for the k-means subspace algorithm on the whole ..

Read more