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

Eigen behavior when casting to the same underlying type

I have a template class, MyClass<...>, which has member variables of type Eigen::Matrix where X is the native template parameter for a particular instance of MyClass. Assuming that my private variable of the aforementioned type is myVar. In…
ozlsn
  • 144
  • 4
3
votes
2 answers

Implementing the Bartels–Stewart algorithm in Eigen3?

In the past when I've needed to solve the Sylvester equation, AX + XB = C, I've used scipy's function, solve_sylvester [1], which apparently works by using the Bartels-Stewart algorithm to get things into upper triangular form, and then solving the…
sudo make install
  • 5,629
  • 3
  • 36
  • 48
3
votes
1 answer

Clear, Move, Animate a Point on libigl Viewer?

I would like to use the libigl viewer to display a 3d model and a point. The 3d model will remain unchanged at all time, but the point will move around. My current approach is basically: load the 3d model and point viewer.data().clear() to clear…
BrianFruit
  • 53
  • 9
3
votes
1 answer

Eigen: How to check if Matrix is invertible

I would like to generate a random invertible Matrix using Eigen, which fulfills these criteria: Eigen::Matrix res(M, N + 1); Eigen::Matrix y(M, 1); y.setRandom(); while (true) { …
Clebo Sevic
  • 581
  • 1
  • 7
  • 17
3
votes
2 answers

Write arbitrary Eigen object to row-major plain storage

I am writing a module to write data to a file which uses by convention only row-major storage. I would like my function to be able to allow both column-major and row-major Eigen objects as input. Currently I first use Eigen to copy a column-major…
Tom de Geus
  • 5,625
  • 2
  • 33
  • 77
3
votes
1 answer

Issues including Eigen for simple C++ TensorFlow Lite test program

I compiled the library for the C++ API for TensorFlow Lite (r1.97) using the script ${TENSORFLOW_ROOT}/tensorflow/lite/tools/make/build_rpi_lib.sh following the steps suggested at this official page (Native Compiling, downloading the necessary…
mzs
  • 43
  • 6
3
votes
0 answers

Solving Quaternionic Hermitian Matrices using Eigen

Does Eigen allow for spectral decomposition of Quaternionic Matrices? I'm trying to generate matrices from the Gaussian Symplectic Ensemble (Quaternionic Hermitian/Self-Adjoint Matrices) to experiment with the eigenvalue spacings (Wigner Surmise)…
user8302493
3
votes
1 answer

How to use Eigen::Ref with pybind11?

I'm using pybind to wrap C++ code. Given the following function, which is originally part of a library and should not be modified: void manipulate(Eigen::MatrixXd& data) { data = data*2; } Using pybind, I can wrap it as: #include…
ilciavo
  • 3,069
  • 7
  • 26
  • 40
3
votes
0 answers

How to circular shift a 2D Eigen Array?

What is the best (by which I mean the fastest and/or most efficient) way to perform a circular shift on a 2D Eigen array? For example, I would like to circularly shift a ArrayXXd to the right. I think I can do something like the…
crobar
  • 2,810
  • 4
  • 28
  • 46
3
votes
2 answers

Write a function with transpose as argument with the Eigen 3 library

I want to write a function that can accept: a dense array/matrix, or the transpose of a dense array/matrix. Is it possible to avoid using perfect forwarding? I have tried to use DenseBase type argument. But that can't accept the transpose of a…
R zu
  • 2,034
  • 12
  • 30
3
votes
1 answer

Eigen map from 2d array

Why does this work typedef Matrix Mat; cout << Map(&m[0][0]) << endl; but this doesn't cout << Map>(&m[0][0]) << endl; Would it be possible to do the whole thing in one line? The error…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
3
votes
1 answer

creating `alglib::integer_1d_array` with `Eigen::Matrix`

I keep getting the error error: no matching function for call to 'alglib::integer_1d_array::setcontent(int, Eigen::PlainObjectBase >::Scalar*)'. For some reason alglib::integer_1d_array doesn't like to be instantiated in the…
Taylor
  • 1,797
  • 4
  • 26
  • 51
3
votes
1 answer

Where are the MatrixXd and VectorXd define in Eigen(c++)? I can't find the definition of them through the grep command

I search through the entire source code of Eigen(https://github.com/eigenteam/eigen-git-mirror), but can not fine the definition of some types such as MatrixXd and VectorXd. The document of…
Ming Wang
  • 133
  • 1
  • 5
3
votes
1 answer

MPI Receive and Send for Eigen compressed sparse matrix

What is the best (fastest) way to send and receive sparse matrix that is defined using Eigen library? Currently, I am creating a value, row and column vector (from a pre-defined sparse matrix) using only the nonzero elements and sending/receiving…
qubit10
  • 81
  • 1
  • 5
3
votes
3 answers

Setting Eigen Matrix/Vector by index

How exactly do we set the value of an Eigen Vector or Matrix by index. I'm trying to do something similar to: // Assume row major matrix[i][j] = value // or vector[i] = value I might have missed it, but could not find anything in the quick…
tangy
  • 3,056
  • 2
  • 25
  • 42