Category : eigen3

I’m computing Homography for different shapes i.e (QUAD, HEXAGON, TRIANGLE). This logic is working fine for QUAD but not working for Hexagon or triangle. Here is my code: #import <Foundation/Foundation.h> #import "EigenWrapper.h" #import <Eigen/Dense> @implementation EigenWrapper constexpr double W = 800; constexpr double H = 800; constexpr size_t NQUAD = 4; constexpr size_t NTRI = ..

Read more

I’m currently developing a C++/Python package using pybind11 for the Python bindings. This project is mixed: it has parts which are written in Python and other parts which are written in C++ and are compiled as an external module. The project uses cmake>1.7. Roughly this is the directory structure of the project: PythonProject -> python_sources ..

Read more

I am trying to rewrite an algorithm parallelized with OpenMP to try out the target accel. device capabilities of OMP. I stumbled over the following problem (see example) when trying to use Eigen (3.4 rc1) within the OMP construct: Minimal Example #include <iostream> #include <Eigen/Eigen> #include <cmath> using Eigen::MatrixXd; int main() { int n = ..

Read more

I have below Eigen C++ code and doing squredNorm calculations 10milliyon times. Is there anyway to make it more robust/faster . #include <Eigen/Core> #include <tbb/parallel_for.h> #include "tbb/tbb.h" #include <mutex> #include <opencv2/opencv.hpp> int main(){ int numberOFdata = 10000008; Eigen::MatrixXf feat = Eigen::MatrixXf::Random(numberOFdata,512); Eigen::MatrixXf b_cmp= Eigen::MatrixXf::Random(1,512); int count_feature = feat.rows(); std::vector<int> found_number ; std::mutex mutex1; for (int ..

Read more

I’m trying to compile some code that uses the same version of Eigen as TensorFlow 2.2 (https://gitlab.com/libeigen/eigen/-/tree/52a2fbbb008a47c5e3fb8ac1c65c2feecb0c511c). The abbreviated command line I’m using to do so is: tools/cc/gcc74/bin/nvcc-wrapper -nostdinc -isystem external/gcc_7_4/usr/include/c++/7 … ‘-D_GLIBCXX_USE_CXX11_ABI=0’ -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -g1 -O2 ‘-std=c++14’ … -fPIC -DEIGEN_MPL2_ONLY ‘-DEIGEN_MAX_ALIGN_BYTES=16’ ‘-DEIGEN_MAX_STATIC_ALIGN_BYTES=16’ ‘-D__CUDACC_VER_MAJOR__=10’ ‘-D__CUDACC_VER_MINOR__=0’ -DEIGEN_HAS_CUDA_FP16 -iquote … This results in a number of compilation errors: ..

Read more

This question shows how to return a double matrix to matlab using a map object. Pass C++ Eigen matrix to Matlab mex output The following works for non-complex data. double *outputPtr; plhs[0] = mxCreateDoubleMatrix((mwSize)n, (mwSize)m, mxREAL); outputPtr = mxGetPr(plhs[0]); Map<MatrixXd> output(outputPtr, n, m); Since matlab stores real and complex elements of a matrix separately rather ..

Read more

If I want to create a C++ function with Eigen that accepts a matrix as a parameter I can do the following: void f(const Eigen::MatrixXf& mat) { /*…*/ } but if the data is not in an Eigen::MatrixXf then I need to create one to hold it and duplicate the (potentially large) data under its ..

Read more