eigen

Eigen equivalent of Matlab rescale command

三世轮回 提交于 2019-12-24 07:16:35
问题 I'd like to recreate the Matlab rescale command in Eigen https://www.mathworks.com/help/matlab/ref/rescale.html I've tried to translate but not sure about it. My Eigen knowledge is too limited still... auto rescale = [&]( Eigen::MatrixXd mat, Eigen::VectorXd inmin, Eigen::VectorXd inmax, Eigen::VectorXd l, Eigen::VectorXd u ) -> Eigen::MatrixXd { auto val = l.array() + ( ((mat - inmin).array()) / (( ((inmax - inmin).array()) * ((u - l).array()) ).array()) ); return val; }; could this be

How to patch Eigen 3.3.7 to workaround a GCC 8.2.1 bug (arm-none-eabi 8-2018q4-major toolchain)?

一曲冷凌霜 提交于 2019-12-24 03:27:26
问题 I was trying to compile Eigen 3.3.7 with Arm's bare metal 8-2018q4-major toolchain and see the very same error (see the x86_64 variant question). It was just plain unlucky for ARM to pick an affected snapshot (20181213) as their release. Embedded toolchain is nightmare-ish to patch so I opt to patch Eigen instead. Is this the right way of doing so? (source) to workaround this GCC bug? inline BlockType& operator=(const BlockType& other) { - return operator=<BlockType>(other); + return this-

How to add Eigen library to c++ project

依然范特西╮ 提交于 2019-12-24 02:05:13
问题 Probably a dumb / simple question, but I have not been able to find an answer. I have no clue how adding libraries works with CodeBlocks c++. I downloaded the .zip file from http://eigen.tuxfamily.org/index.php?title=Main_Page and extracted the files into my directory. How can I use this library now in my project? 回答1: It's a template library. You can put it anywhere as long as it's in the path (accessible). Just include the proper headers and it should work. No need to link anything,

How to add header files path relative to the current file?

◇◆丶佛笑我妖孽 提交于 2019-12-24 01:17:12
问题 I have the file mx_minimum_power.cpp in the following directory D:\thesis library.Data\ALOS-PALSAR 12x2\San Francisco L 12x2 and 14 header files that I want to include to the cpp file in the following directory: D:\thesis library.Data\ALOS-PALSAR 12x2\San Francisco L 12x2\Eigen\Eigenvalues so the relative path to these .h files with respect to my .cpp file is \Eigen\Eigenvalues How should I include all those header files relative path. I've done so far: #include <math.h> #include <complex>

Fixed Sized Eigen types as parameters

青春壹個敷衍的年華 提交于 2019-12-24 00:58:00
问题 I am trying to write a function that takes fixed size Eigen Types (but templated on Scalar type e.g. float/double). I have read http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html but I am not able to make it work perfectly. Here is the function definition: template <typename T> inline Matrix<T, 3, 3> makeSkewSymmetric(const Matrix<T, 3, 1>& v) { Matrix<T, 3, 3> out; out << 0, -v[2], v[1], v[2], 0, -v[0], -v[1], v[0], 0; return out; } Now I am using this as following: Vector3d a

is eigen dense-sparse matrix product threaded?

南笙酒味 提交于 2019-12-24 00:54:40
问题 I know that sparse-dense product is threaded according to the documentation: https://eigen.tuxfamily.org/dox/TopicMultiThreading.html What about dense-sparse? 回答1: To be more precise, sparse-dense product is multithreaded only if the left-hand-side sparse matrix is row-major. Conversely, dense-sparse products is multithreaded if the right-hand-side sparse matrix is column-major. 来源: https://stackoverflow.com/questions/49959657/is-eigen-dense-sparse-matrix-product-threaded

How to read CSV file and assign to Eigen Matrix?

筅森魡賤 提交于 2019-12-24 00:14:09
问题 I try to read a large cvs file into Eigen Matrix, below the code found having problem where it can not detect each line of \n in cvs file to create multiple rows in the matrix. (It read entire file with single row). Not sure what's wrong with the code. Can anyone suggest here? Im also looking for a effective way to read csv file with 10k of rows and 1k of cols. Not so sure the code below will be the best effective way? Very appreciated with your comment. #include <stdio.h> #include <stdlib.h>

passing sparse arrays from matlab to Eigen (C++) and back to matlab?

[亡魂溺海] 提交于 2019-12-23 23:06:27
问题 The following is a mex code that multiplies dense arrays g and G from matlab using Eigen. How do I do this when g is sparse? #include <iostream> #include <Eigen/Dense> #include "mex.h" using Eigen::MatrixXd; using namespace Eigen; /*gateway function*/ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int nRows=(int)mxGetM(prhs[0]); int nCols=nRows; double* g=mxGetPr(prhs[0]); double* Gr=mxGetPr(prhs[1]); Map<MatrixXd> gmap (g, nRows, nCols ); Map<MatrixXd> Grmap

Eigen: vector or matrix componentwise to power?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 22:34:33
问题 Given a vector of reals c and a vector of integers rw , I want to create a vector z with elements z_i=c_i^rw_i . I tried to do this using the component-wise function pow , but I get a compiler error. #include <Eigen/Core> typedef Eigen::VectorXd RealVector; typedef Eigen::VectorXi IntVector; // dynamically-sized vector of integers RealVector c; c << 2, 3, 4, 5; IntVector rw; rw << 6, 7, 8, 9; RealVector z = c.pow(rw); **compile error** The compiler error is error C2664: 'const Eigen:

Is this declaration of an Eigen::Tensor in C++ safe, or buggy? And should I submit an issue for it?

非 Y 不嫁゛ 提交于 2019-12-23 22:26:49
问题 Using Eigen's unsupported Tensor module, if I do: size_t dim0 = 3; size_t dim1 = 2; size_t dim2 = 4; Eigen::Tensor<double, 3> var(dim0, dim1, dim2); I get the following error: /usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:287:167: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'std::__1::array<long, 3>::value_type' (aka 'long') in initializer list [-Wc++11-narrowing] But the code compiles OK if I explicitly cast the dimensions