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 Center および File ExchangeMATLAB Compiler についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by