mlx: pass a sparse matrix

2 visualizzazioni (ultimi 30 giorni)
Zohar
Zohar il 1 Giu 2022
Modificato: Zohar il 12 Giu 2022
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?

Risposta accettata

Zohar
Zohar il 11 Giu 2022
Modificato: Zohar il 12 Giu 2022
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

Più risposte (0)

Categorie

Scopri di più su MATLAB Compiler in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by