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
6
votes
3 answers

Different behaviours when initializing differently

When trying to initialize a Vector using the result of some operation in Eigen, the result seems to be different depending on what syntax is used, i.e., on my machine, the assertion at the end of the following code fails: const unsigned int n =…
pfisch
  • 63
  • 5
6
votes
1 answer

How to use pybind11 to convert between Eigen::Quaternion and numpy ndarray

I am trying to wrap up a c++ function that takes in Eigen::Quaternion as the argument for python usage. The function is defined as something like: void func(const Eigen::Quaternion &rotation) {...} I am using pybind11 to wrap it for python…
shelper
  • 10,053
  • 8
  • 41
  • 67
6
votes
2 answers

Frequencies when performing FFT with Eigen::FFT

I'm currently trying to figure out how exactly to use Eigen's FFT algorithm. Let us a assume I have a function std::complex f(std::complex const & t){ return std::sin(t); } I then compute with this function Eigen::VectorXcd…
Sito
  • 494
  • 10
  • 29
6
votes
1 answer

How to use Eigen::Tensor::convolve with multiple kernels?

Convolving an input tensor of shape (3, 20, 30) (channel-first notation) with 8 filters of shape (3, 5, 7) should result in a tensor of shape (8, 24, 16). I'm trying to implement this using Eigen::Tensor::convolve, but the resulting shape is (1, 24,…
Tobias Hermann
  • 9,936
  • 6
  • 61
  • 134
6
votes
1 answer

Eigen3 tensor slices without making a copy of the data

I have been testing the Tensor module from Eigen3 for a new project. Even when the module is not yet finished, it seems to have most of the functionality that I need. But there is one part that I quite not get. Whenever I have a big Tensor and I…
JdlCR
  • 155
  • 7
6
votes
2 answers

Displaying an affine transformation in Eigen

I am trying to do something as simple as: std::cout << e << std::endl; where e is of type Eigen::Affine3d. However, I am getting unhelpful error messages like: cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to…
FvD
  • 1,286
  • 13
  • 25
6
votes
2 answers

How to slice a TensorMap?

I understand that the Tensor class supports slicing, but when I tried to do slicing on a TensorMap instance, the error is that the operation is not supported. How can I slice a TensorMap?
dalibocai
  • 2,289
  • 5
  • 29
  • 45
6
votes
1 answer

Mapping row-major array to column-majored Eigen Matrix

I want to map from a C-type array to a Column majored Eigen matrix. The mapping itself is using the RowMajor type, so I tried std::vector a(9); double *p= a.data(); Eigen::MatrixXd M=Eigen::Map
lorniper
  • 626
  • 1
  • 7
  • 29
6
votes
1 answer

performance regression with Eigen 3.3.0 vs. 3.2.10?

We're just in the process of porting our codebase over to Eigen 3.3 (quite an undertaking with all the 32-byte alignment issues). However, there's a few places where performance seems to have been badly affected, contrary to expectations (I was…
jdtournier
  • 365
  • 3
  • 10
6
votes
1 answer

OpenMP reduction with Eigen::VectorXd

I am attempting to parallelize the below loop with an OpenMP reduction; #define EIGEN_DONT_PARALLELIZE #include #include #include #include #include #include using…
AlexD
  • 325
  • 2
  • 6
6
votes
1 answer

Expression templates in Eigen

I would like to understand how expression templates work in Eigen. I understood that the sum of two dynamical double vectors is performed by something which looks like this : CwiseBinaryOp< internal::scalar_sum_op, VectorXd const, VectorXd…
Aleph
  • 1,343
  • 1
  • 12
  • 27
6
votes
2 answers

c++ Large eigendecomposition speed

As part of my pipeline I need to perform eigendecomposition of a big matrix in the order of 6000x6000. The matrix is dense, so except if I simplify the problem (sot sure if possible) no sparse method can be used. At the moment I play with toy data.…
dim_tz
  • 1,451
  • 5
  • 20
  • 37
6
votes
1 answer

How much faster is Eigen for small fixed size matrices?

I'm using Julia at the moment but I have a performance critical function which requires an enormous amount of repeated matrix operations on small fixed size matrices (3 dimensional or 4 dimensional). It seems that all the matrix operations in Julia…
Lindon
  • 1,292
  • 1
  • 10
  • 21
6
votes
1 answer

Index of max coefficient (column wise) in Eigen

In Eigen, I can do a row-wise or column-wise "partial reduction" to get the maximum coefficients. For example, this program: #include #include int main() { Eigen::MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7,…
zmb
  • 7,605
  • 4
  • 40
  • 55
6
votes
2 answers

How to write/read an Eigen matrix from binary file

To write Eigen::Matrix to file I really like to use the following: typedef Eigen::Matrix Matrix_MxN; Matrix_MxN J = Matrix_MxN::Zeros(10,10); std::ofstream("matrix.txt") << J; But unfortunately,…
andrea
  • 839
  • 3
  • 9
  • 16