How can i manipulate c code generated from MATLAB Coder?(DLL)

3 次查看(过去 30 天)
Hello everyone!
I have a matlab project, which consists of a main function and many outsourced subfunctions.I would like to execute this project in c for better performance. I have used the following work instruction:
(I used the Matlab coder, to write c functions using DLL)
The matlab coder then outputs the corresponding functions translated into c. The procedure works, but the most computationally intensive part of the program, a matrix inversion, still takes a lot of time. that's why I want to rewrite the files generated by the coder so that they do the matrix inversion through the "eigen-library".
For whatever reason, the change i make to the inv.c file has no effect on the execution of the created project in visual studio. Even if I add an error that should make the inv.c function not work at all, the matrix inversion is executed normally, as if I had not made any changes at all.
Now my question is how I can manipulate this generated c code so that the change takes effect in the created project.
And if you know another way to execute a matrix inversion more efficient than MATLAB, please let me know too!
Thank you and happy holidays!

回答(1 个)

David Fink
David Fink 2023-12-22
MATLAB Coder can be configured to use BLAS and LAPACK calls in generated code, which can improve the performance of linear algebra operations like matrix inverse:
However, note that solving systems of equations Ax = b via \ (mldivide) can be more accurate and efficient than using inv:

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by