`mlx` interface for Java packaging of Matlab functions?

10 views (last 30 days)
FM
FM on 27 Oct 2020
Commented: FM on 29 Oct 2020
I am looking at the Matlab information on packaging functions for invocation from Java, specifically in the context of a variable number of input arguments. A number of function signatures are for "mlx interface", but there is no explanation of what this means.
Web searching shows that *.mlx is file extension of Jupyter-like file for Matlab code. It is unclear whether this has anything to do with the use of this acronym in the Java interface documentation cited above. The manner in which it is presented seems to indicate that any reader should know what it is, and mlx signatures take up half of the examples shown, so it is obviously a prominent use case. In contrast, I've never heard of a Jupyter-like Matlab file before, and likewise, did not know of an *.mlx file extension until now (though there are many TMW corners I've not ventured near).
What does "mlx interface" mean in the context of function signatures in Java packaged Matlab?
Why does it figure so prominently into the Java interface?
  1 Comment
FM
FM on 27 Oct 2020
It looks as if the answer is not available in Matlab's `doc` documentation, nor the HTML counterparts on the web. Hints of the answer are buried deep in real-book documenation like MATLAB Compiler SDK Java User's Guide:
"A standard signature in Java...specifies input arguments for each overloaded method as one or more input arguments of class java.lang.Object or any subclass (including subclasses of MWArray). The standard interface specifies return values, if any, as a subclass of MWArray."
"[The] mlx API...allows the user to specify the inputs to a function as an Object array, where each array element is one input argument. Similarly, the user also gives the mlx interface a preallocated Object array to hold the outputs of the function. The allocated length of the output array determines the number of desired function outputs."
"The mlx interface may also be accessed using java.util.List containers in place of Object arrays for the inputs and outputs. Note that if List containers are used, the output List passed in must contain a number of elements equal to the desired number of function outputs."
A web search for `mlx-api` shows that it is Matlab interface for C/C++: Functions Generated from MATLAB Files. While the acronym `mlx` may have been motivated by this, it seems that the only thing inheritted by the Java signature is the acronym. The signature itself is completely dissimilar to that in the page posted in the original question: Pass Variable Numbers of Inputs.

Sign in to comment.

Accepted Answer

Todd Flanagan
Todd Flanagan on 29 Oct 2020
Java packages produced by the Compiler SDK product support a variety of signatures and has expanded over time.
New users to the SDK product are encouraged to use the more natureal Object and List style signatures. Ealier adopters of the product can still use earlier signatures like "mlx" which was an interface modelled on a c-style interface that was familiar to some external interfaces in MATLAB.
Note that today, mlx is a term that more commonly referes to a live script or live funciton file format.
  1 Comment
FM
FM on 29 Oct 2020
Thank you, Todd. I will simply ignore the "mlx" signatures, as the convention differs from the standard signatures. That is, the array nature of the input argument is explicit in the "Object[]" notation, whereas the standard signatures expects the coder to assume that "Object" represents an array.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by