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