mlx: pass a sparse matrix

2 次查看(过去 30 天)
Zohar
Zohar 2022-6-1
编辑: Zohar 2022-6-12
I got the mlx working:
First, I still don't know how to unload/release the dll interface after using it. If I'm in the process of developing one, it won't build it since the file is used by matlab (that needs to be killed to release it).
I can pass to the dll basic types including an array. But how do I pass matrices or sparse matrices (conveniently, without converting them first to arrays)?
Another thing: is it possible to build the .dll within visual studio?

采纳的回答

Zohar
Zohar 2022-6-11
编辑:Zohar 2022-6-12
From matlab support (Jerry Yan):
1. If it’s already loaded, no way to unload yet. The ability to unload the generated interface library is not available in MATLAB now. There is no workaround other than restarting MATLAB.
2. To pass matrix as a parameter to the interface, a good option is using “calllib” function to pass a matrix. Please refer to the following links to get more information.
https://www.mathworks.com/matlabcentral/answers/93197-how-can-i-pass-a-matrix-to-a-function-in-a-dll-defined-with-a-double-header-in-matlab-7-10-r2010
https://www.mathworks.com/help/matlab/matlab_external/pass-arrays.html
3. I understand that you want to build all things directly from Visual Studio. However, there is no command line usage outside of MATLAB for “clibgen.buildInterface”.
---
Regarding the second question, just get a set of triplets using find() and pass it along with the dimensions (all wrapped in a nice structure).
I'm wondering if it won't be easier to write a swig python extension and call python. It will resolve 1 & 3 since the python interface is more mature.
Call User-Defined Python Module - MATLAB & Simulink - MathWorks Australia
https://au.mathworks.com/help/matlab/matlab_external/call-user-defined-custom-module.html
MATLAB to Python Data Type Mapping - MATLAB & Simulink - MathWorks Australia
https://au.mathworks.com/help/matlab/matlab_external/passing-data-to-python.html

更多回答(0 个)

类别

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

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by