Questions tagged [eigen3]

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Homepage: http://eigen.tuxfamily.org

Please use eigen3 tag specifically for questions related to version 3 of the library.

1014 questions
2
votes
1 answer

Two similar pose has a big relative euler angle

There are two similar poses represented by Euler angle: s_euler_angle_o1: 0.000549608 -3.1334 1.23193 s_euler_angle_o2: 0.0222646 -3.10948 1.31032 But the relative Euler angle computed by Eigen is o1_euler_angle_o2: …
2
votes
1 answer

Data transfer between LibTorch C++ and Eigen

Data transfer between LibTorch C++ and Eigen (Questions and Help) Hello all, I'm developing a Data Transfer Tools for C++ Linear Algebra Libraries, as you can see here: https://github.com/andrewssobral/dtt (considering bi-dimensional arrays or…
2
votes
1 answer

How to reshape a tensor in Eigen3?

I get some Eigen::TensorMap from the outputs vector from a tensorflow session in C++. I want to do some operations to the Eigen::TensorMap (reshape and concat etc.). However, my codes cannot be compiled due to some weird error. I tried to reproduce…
Robin Lew
  • 315
  • 4
  • 12
2
votes
1 answer

Why doesn't conservativeResize work with Ref variable in a function?

I am making a function that can extend the given Matrix which is MatrixXd type. I was trying to use conservativeResize to achieve that, but when i use Ref in the function statement, conservativeResize doesn't work with with the Ref object, but…
Oliver Yu
  • 99
  • 5
2
votes
2 answers

Using coeffRef with const CwiseUnaryView - Failing when multiplying two CWiseUnaryViews

I'm having some trouble when using coeffRef() with a CWiseUnaryView function, but only when the function is declared as const Reproducible example: #include struct dummy_Op { EIGEN_EMPTY_STRUCT_CTOR(dummy_Op) EIGEN_DEVICE_FUNC …
AndrewrJ
  • 49
  • 1
  • 8
2
votes
1 answer

Eigen3 fails to install with cmake : RegexUtils not found

I try to install eigen3.3.7 with cmake on ubuntu 16 but cmake fails. I follow the INSTALL file hints : 1) I extract the tar archive 2) Make a "build" dir named buildDir 3) Go to build dir : cd buildDir 4) Start cmake : cmake ../Eigen Then the…
sylwa06
  • 77
  • 10
2
votes
1 answer

Write access violation when solving sparse linear system with a large matrix

Good evening, i've written a program that uses Eigen3 to solve a sparse linear system where the input matrix is an SPD matrix in .mtx format and the output x should be a vector of ones. I've to test 9 different matrices, the program works fine with…
2
votes
1 answer

How to perform row-wise clipping of a matrix in Eigen?

I need to clip (i.e. clamp) elements in every row of a matrix. Each column has its minimum and maximum specified in a two-row matrix (in first row there are minimums, in the second row there are maximums). I'm currently using this ugly approach to…
wlcezar
  • 25
  • 4
2
votes
1 answer

Check at compile time the data held by Eigen type is contiguous in memory

I am writing some generic code that would process Eigen expression differently for those that hold continuous data in memory and those do not. I know that at run time, this can be done by checking expr.innerSize() == expr.outerStride() &&…
Jerry Ma
  • 511
  • 4
  • 15
2
votes
3 answers

Eigen unaryExpr(): get index of element

I know that in Eigen I can use unaryExpr() to apply a custom function to my Eigen Matrices and Vectors, e.g. Eigen::VectorXd vec(4); vec.unaryExpr([](double d) { return d * cos(d); }); to apply custom functions to a Eigen::VectorXd. But is…
T-Rex96
  • 355
  • 4
  • 15
2
votes
2 answers

Convert template parameter into comma-separated list of template parameters

Apologies if the title is misleading or if this question has been answered before. I'm working with Eigen's Tensor module, particularly the Eigen::TensorFixedSize class as I know the shape at compile time. Essentially, because this is a Lorentz…
jd13386
  • 23
  • 2
2
votes
2 answers

Eigen: sparse matrix pruned() does not remove entries below threshold

I want to use Eigen for sparse matrix multiplications, where in each iteration I want to remove all entries below a certain threshold. It seems to me that Eigen only removes elements exactly equal zero. I am running Eigen 3.3.7, compiling with…
swissroll
  • 23
  • 2
2
votes
2 answers

pass data between C++ Eigen Matrix and MATLAB mxArray with a cell array

I would like to pass data between Eigen Matrix/Vector and mex arrays. In the following code, I defined a mex array called y_output, which contains a cell array. The variable y_output will be passed to MATLAB. Each element in y_output is a vector but…
Bayes
  • 45
  • 1
  • 11
2
votes
1 answer

Concatenate (stack up) Eigen::Tensors to create another tensor

I want to concatenate or stack-up 3 2D tensors to a 3D tensor. How to do it in Eigen::Tensor? Code: #include #include int main() { Eigen::Tensor u(4, 4, 3); Eigen::Tensor a(4,4), b(4,4),…
mahesh
  • 1,028
  • 10
  • 24
2
votes
2 answers

Eigen:: cannot convert Block to Ref when number of cols is fixed

I recently updated to recent Eigen version (3.3.90) and it looks like it broke stuff I though was working before (prior that I was using an Eigen version 3.2.10 shipped with the libigl library). I would like to store the result of a block into a ref…
jerome
  • 23
  • 2