Intro to Eigen C++ Matrix Library- Easy Library for Matrix and Linear Algebra Computations

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 61

  • @aleksandarhaber
    @aleksandarhaber  2 года назад +1

    It takes a significant amount of time and energy to create these free video tutorials. You can support my efforts in this way:
    - Buy me a Coffee: www.buymeacoffee.com/AleksandarHaber
    - PayPal: www.paypal.me/AleksandarHaber
    - Patreon: www.patreon.com/user?u=32080176&fan_landing=true
    - You Can also press the Thanks RUclips Dollar button

  • @aleksandarhaber
    @aleksandarhaber  Год назад +1

    Here is how to install Eigen C++ in VS Code: ruclips.net/video/fUxp3upZsk0/видео.html

  • @aleksandarhaber
    @aleksandarhaber  4 года назад +1

    I made another video on how to make a simple platform-independent GUI in C++ and how to plot Eigen objects in C++:
    ruclips.net/video/0dFWH0Ouaao/видео.html

  • @aleksandarhaber
    @aleksandarhaber  4 года назад +1

    The post accompanying this video can be found here:
    aleksandarhaber.com/starting-with-eigen-c-matrix-library/
    and the codes can be found here
    github.com/AleksandarHaber/Introduction-to-Eigen-C-Matrix-Computation-Library

  • @umedina98
    @umedina98 4 года назад +7

    Thank you man! Migrating from Matlab to C++ and was looking for a way to do more easily matrix operations and this was a savior, the only video that I could find that really helped me...

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +3

      Glad it helped! Look also at this new video for building simple GUIs (platform independent) and how to plot Eigen C++ graphs: ruclips.net/video/0dFWH0Ouaao/видео.html

    • @umedina98
      @umedina98 4 года назад +1

      @@aleksandarhaber Thanks sure!

  • @aleksandarhaber
    @aleksandarhaber  4 года назад +1

    The codes explained in this video are used in the following Eigen C++ projects:
    Simulate State-Space Models of Dynamical Systems in C++:Eigen C++ Tutorial- Object-Oriented Design ruclips.net/video/Ss7vg5r05rI/видео.html
    and in this one
    Save and Load Eigen C++ Data In and From CSV files: ruclips.net/video/K9QB1LbemnY/видео.html

  • @rv4tyler
    @rv4tyler Год назад +1

    Getting back to C++ to do some AI and graphics work. Excellent content that got me up to speed quickly with Eigen3 library in VS 2022.

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      Thank you very much for the nice comment and thank you very much for your donation! Aleksandar Haber

  • @VasilevArtem-g4u
    @VasilevArtem-g4u 2 года назад +1

    thank for such brief and simultaneously useful tutorial

  • @matteoverardo8005
    @matteoverardo8005 2 года назад +1

    Thank you so much for this useful video.

  • @ethanjoe2487
    @ethanjoe2487 Год назад +1

    thanks for your tutorial, it's very helpful

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      You have a video on how to do this in VS Code and C++.. This is the newest video. VS Code is the editor people are using.

  • @tzgardner
    @tzgardner Год назад +3

    Great tutorials! I was curious if you have any examples of using the Eigen Map functionality to wrap other matrix types or even complex Objects into an Eigen Matrix to be able to perform Eigen computations?

    • @aleksandarhaber
      @aleksandarhaber  Год назад

      Unfortunately, I do not... However, for complex matrices you can use MatrixXcd - this is a type definition that can store complex numbers as entries of matrices. You can also look into this tutorial: ruclips.net/video/4bzlMmd67WM/видео.html made by a NASA JPL scientist.

  • @pedrovelazquez138
    @pedrovelazquez138 3 года назад +1

    NIce tutorial!! Greetings from Paraguay.

  • @minkworks6143
    @minkworks6143 3 года назад +1

    Great video. Thanks for posting this!

  • @mostafazayed5764
    @mostafazayed5764 3 года назад +1

    Thanks man for simplicity

    • @aleksandarhaber
      @aleksandarhaber  3 года назад +1

      Hi Mostafa, Thank you for the nice comment!

  • @chriscruz429
    @chriscruz429 2 года назад +2

    Thanks for making this video, I’m currently learning to implement ML methods and I’ll be using the Eigen library. Your video helped me understand the basics of it and even showed me how to plug it in. I do have one question, I’m pretty sure I’m not 100% sure, the way you set up the Eigen lib means that it’s dynamic library and the linker will handle the connections during the linking stages, correct????

    • @aleksandarhaber
      @aleksandarhaber  2 года назад +1

      Thank you for the interest. I am not sure about the answer, let me know when you figure it out!

    • @chriscruz429
      @chriscruz429 2 года назад +2

      @@aleksandarhaber It turns out is not a Dynamic Lib, it’s actually a Template Library but from a third party source and is not part of the Standard Libs.

    • @aleksandarhaber
      @aleksandarhaber  2 года назад +1

      @@chriscruz429 valuable information

  • @shrivatsankchari1729
    @shrivatsankchari1729 2 года назад +1

    In line 29, we use MatrixX because the size is unknown but then pass (10,10) as the dimension?

  • @komxun
    @komxun Год назад +2

    17:45 Why is matrixV.block(0,0,2,2) a 2x2 instead of a 3x3 matrix?

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      You can simply google it to figure out:
      eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html

    • @komxun
      @komxun Год назад +1

      @@aleksandarhaber Ok, from the website, m.block(0,0,2,2) gives 2x2 and m.block(0,0,1,1) gives 1x1, but why does matrixV.block(1,1,2,2) in your video give 2x2 but not 1x1?

    • @aleksandarhaber
      @aleksandarhaber  Год назад

      @@komxun Okay, I see that there is some misunderstanding here. I really do not have time to answer all the questions. Please be considerate and respect my time. Try to learn things independently, and please do not ask minor questions on my youtube channel. This is not a forum where I can spend hours answering your questions for free. Thank you!

    • @komxun
      @komxun Год назад +1

      ​@@aleksandarhaber It's a fundamental question which is very important. I think it takes less time for you to directly answer my question (if you know) than to type what you just typed.

    • @ligonapProduktion
      @ligonapProduktion 5 месяцев назад

      matrix.block(i, j, p, q);
      The block has a fixed size of (p, q). And starts at matrix element (i,j).

  • @bachirdekdouk5440
    @bachirdekdouk5440 7 месяцев назад

    Hi Aleksander. Thanks for nice intro. Have a question pls. How to loop over 2d slices of 3 dimensional matrices. for example in matlab. a = zeros(2,2,2), b = ones(2,2), for i = 1:2 a(:,:,i) = b end. What would be the most efficient and user friendly way to implrment this in C++ using eigen. I tried using Tensor, but I got lost with the approach of using indices and offsets. Thanks in advance

  • @guima_dev
    @guima_dev 3 года назад +5

    Hi professor! Could teach us how installing and use Eigen library on VsCode editor? (on Windows)
    I'm trying do it but I'm not having success

    • @aleksandarhaber
      @aleksandarhaber  3 года назад +1

      Hi Lucas, I am not using VsCode editor. Currently, I do not have enough time to dig into this problem, however, I guess that the principle should be the same. The Eigen library is in header files, so the procedure should be to figure out how to include these header files and to tell to VsCode were to look up for them. Best, A. Haber

    • @guima_dev
      @guima_dev 3 года назад +1

      @@aleksandarhaber No problem professor. Thanks for your tips, I'll try it.

    • @aleksandarhaber
      @aleksandarhaber  Год назад +2

      Here is the video tutorial on how to install Eigen in VS code:
      ruclips.net/video/fUxp3upZsk0/видео.html
      Best, A. Haber

    • @aleksandarhaber
      @aleksandarhaber  Год назад

      @@guima_dev ruclips.net/video/fUxp3upZsk0/видео.html

  • @liboyan7010
    @liboyan7010 2 года назад +1

    Hello Professor, how to Make Eigen run in parallel? some tutorials?

    • @aleksandarhaber
      @aleksandarhaber  2 года назад +1

      No idea. You have CUDA for parallel implementation.

  • @menaeem
    @menaeem 3 года назад +1

    Is it faster than simple for loop in C++??

    • @aleksandarhaber
      @aleksandarhaber  3 года назад +1

      This library is not only about matrix definitions and multiplications. This library contains optimized algorithms for sparse matrices, decompositions, numerical solvers. You can read this:
      "Explicit vectorization is performed for SSE 2/3/4, AVX, AVX2, FMA, AVX512, ARM NEON (32-bit and 64-bit), PowerPC AltiVec/VSX (32-bit and 64-bit), ZVector (s390x/zEC13) SIMD instruction sets, and since 3.4 MIPS MSA with graceful fallback to non-vectorized code."
      From eigen.tuxfamily.org/index.php?title=Main_Page

  • @wahabfiles6260
    @wahabfiles6260 4 года назад +1

    Good reference to Python and Matlab. I was wondering if Eigen is faster then corresponding Matlab as Matlab also uses c binaries for libraries.

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +3

      My tests show that Matlab is still a bit faster. However, I think that the power of Eigen lies in the fact that you can use it in embedded systems for developing more or less real-time algorithms. After all, it is a C++ library and there are endless possibilities to integrate it in your C++ projects.

    • @wahabfiles6260
      @wahabfiles6260 4 года назад +1

      @@aleksandarhaber makes so much sense! Thanks for the insight.

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +3

      @@wahabfiles6260 I think that MATLAB uses libraries that are highly optimized for Intel or AMD processors and I think that these libraries are not free...

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +2

      @@wahabfiles6260 Also, if you want to compare the computation speed, you can watch my new video ruclips.net/video/Ss7vg5r05rI/видео.html or directly go to the GitHub page
      github.com/AleksandarHaber/Simulation-of-State-Space-Models-of-Dynamical-Systems-in-Cpp--Eigen-Matrix-Library-Tutorial
      and download the code. You will see that I timed the C++ code and I am executing the same code in MATLAB, and I am timing the results in MATLAB. Have a nice weekend.

  • @aliscander92
    @aliscander92 4 года назад +1

    Thank you very much for this intorduction! Is it possible to use Eigen library foк lineal algebra operations on complex matrixes?

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +1

      It is possible and it is widely used:
      stackoverflow.com/questions/34707521/how-to-manually-construct-complex-matrix-in-eigen-library

    • @aliscander92
      @aliscander92 4 года назад +1

      @@aleksandarhaber Thank you! I tried to find it in official documentation.

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +1

      @@aliscander92 No problem, good luck with your project/research!

    • @aliscander92
      @aliscander92 4 года назад +1

      @@aleksandarhaber Thank you!)

    • @aleksandarhaber
      @aleksandarhaber  4 года назад +1

      @@aliscander92 Thank you for the comment and interest.

  • @heimojaakonheimo2385
    @heimojaakonheimo2385 10 месяцев назад +1

    We don't need mathlab for anything.

    • @aleksandarhaber
      @aleksandarhaber  10 месяцев назад

      I agree, especially today since Python has all the functionality that MATLAB has. However, MATLAB is a multinational company that is also promoted by US universities and other corporations. That is why it is still alive.

  • @aleksandarhaber
    @aleksandarhaber  3 года назад +2

    The post accompanying this video can be found here:
    aleksandarhaber.com/starting-with-eigen-c-matrix-library/
    and the codes can be found here
    github.com/AleksandarHaber/Introduction-to-Eigen-Cpp-Matrix-Computation-Library