Mauro Bringolf

Currently geeking out as WordPress developer at WebKinder and student of computer science at ETH.

Summary of matrix and vector block operations in Eigen

November 27, 2017
, ,

Eigen Version: 3.3.4

This semester I am taking a course where all programming assignments are in C++ using the library Eigen 1. For some reason I keep looking up methods to extract a certain part from a matrix or a vector. The library calls these block operations and has a dedicated documentation page on the topic 2. If you prefer something shorter or just want a list of documentation links, here is a short overview of the ones that got me up and running:

Matrix operations

Vector operations

As you can see, almost all of these boil down to special cases of A.block() and v.segment(). However, the Eigen documentation says that the most specific method available will have the most potential for optimizations. In addition to that more specific methods also make more readable code. I hope this either helps someone find a method they need or at least help me finally memorize them!

References

  1. http://eigen.tuxfamily.org
  2. https://eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html
  3. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a09bc4a61cdf4ad219db0e70de12c2ae2
  4. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a27f3b8aeaf37cb1decc9413ffceafa0f
  5. https://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#ab5768147536273eb2dbdfa389cfd26a3
  6. https://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a8a13d4b8efbd7797ee8efd3dd988a7f7
  7. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a0cc046747cc9329cc02e208a122e002e
  8. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a36137187863fe127fe88e7388eacabaa
  9. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#aafb8bf8b8d6d2648f52dadd0e4cba68e
  10. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a4c7c4e7a7264c0acde4632d35a9a2635
  11. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a5a43920b4d907a7edba59c26fba7b43d
  12. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a6212eee4095a0ab9ac3a2202274ea8d7
  13. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#ae458ead2be3576e80ffdfa5616778cd5
  14. https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a70abb2369391a6fe66df2af56e1c2d1e
  15. https://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#ab757d5801a0e038f8555635f06456352