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
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
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
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...
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
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
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?
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.
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 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 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?
@@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!
@@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.
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
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
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
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 I think that MATLAB uses libraries that are highly optimized for Intel or AMD processors and I think that these libraries are not free...
@@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.
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.
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
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
Here is how to install Eigen C++ in VS Code: ruclips.net/video/fUxp3upZsk0/видео.html
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
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
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...
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
@@aleksandarhaber Thanks sure!
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
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.
Thank you very much for the nice comment and thank you very much for your donation! Aleksandar Haber
thank for such brief and simultaneously useful tutorial
Thank you for your comment!
Thank you so much for this useful video.
Thank you for the comment.
thanks for your tutorial, it's very helpful
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.
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?
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.
NIce tutorial!! Greetings from Paraguay.
Many thanks, Pedro.
Great video. Thanks for posting this!
Thank you, Greg!
Thanks man for simplicity
Hi Mostafa, Thank you for the nice comment!
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????
Thank you for the interest. I am not sure about the answer, let me know when you figure it out!
@@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.
@@chriscruz429 valuable information
In line 29, we use MatrixX because the size is unknown but then pass (10,10) as the dimension?
17:45 Why is matrixV.block(0,0,2,2) a 2x2 instead of a 3x3 matrix?
You can simply google it to figure out:
eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html
@@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?
@@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!
@@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.
matrix.block(i, j, p, q);
The block has a fixed size of (p, q). And starts at matrix element (i,j).
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
You asked this question many times.
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
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
@@aleksandarhaber No problem professor. Thanks for your tips, I'll try it.
Here is the video tutorial on how to install Eigen in VS code:
ruclips.net/video/fUxp3upZsk0/видео.html
Best, A. Haber
@@guima_dev ruclips.net/video/fUxp3upZsk0/видео.html
Hello Professor, how to Make Eigen run in parallel? some tutorials?
No idea. You have CUDA for parallel implementation.
Is it faster than simple for loop in C++??
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
Good reference to Python and Matlab. I was wondering if Eigen is faster then corresponding Matlab as Matlab also uses c binaries for libraries.
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.
@@aleksandarhaber makes so much sense! Thanks for the insight.
@@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...
@@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.
Thank you very much for this intorduction! Is it possible to use Eigen library foк lineal algebra operations on complex matrixes?
It is possible and it is widely used:
stackoverflow.com/questions/34707521/how-to-manually-construct-complex-matrix-in-eigen-library
@@aleksandarhaber Thank you! I tried to find it in official documentation.
@@aliscander92 No problem, good luck with your project/research!
@@aleksandarhaber Thank you!)
@@aliscander92 Thank you for the comment and interest.
We don't need mathlab for anything.
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.
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