MWArray: Non-conventional-Matlab terminology for data types and arrays?

1 visualización (últimos 30 días)
As far as I know, and based on the thread "scalar vs matrix vs vector vs array??", a double array in Matlab is an array of type double. A scalar is a single-element array, so the number of dimensions is irrelevant. An array can have any number of dimensions, some of which may have zero size.
The above meanings of double and scalar seem to differ from the "MWNumericArray" documentation:
MWNumericArray(boolean rVal, boolean iVal, MWClassID classid)
Constructs a complex numeric double array that represents the
primitive boolean arguments.
MWNumericArray(boolean rVal, MWClassID classid)
Constructs a real scalar numeric array that represents the
primitive boolean argument.
MWNumericArray(byte rVal)
Constructs a real scalar numeric array of type MWClassID.INT8
that represents the primitive byte argument.
MWNumericArray(byte rVal, byte iVal)
Constructs a complex scalar numeric array of type
MWClassID.INT8 that represents the primitive byte arguments.
In the first function call, what is meant by "complex numeric double array"? Is it a single-element array, with the 1 element using a double for the real part and a double for the imaginary part? Shouldn't the precision be determined by the "classid" argument?
Unlike the first call, the second function call returns a "real scalar numeric". Why is the word "scalar" used here but not in the first call? Is "scalar" being used differently from Matlab to mean non-complex?
If that is the case, then why is the 4th function call also described as returning "complex scalar numeric array)?
AFTERNOTE: Finding even more undefined terminology as I try to reference the information more. For example, the `getDouble` method sometimes returns a "1-based index-array as a double". The internet doesn't seem to return a meaning for "index-array" in the context of Java. (After much mulling & digging: "Index" probably refers to the purpose of the array rather than how the array is realized. Such an array of length "n" contains the coordinates of a single element in an n-dimensional array)

Respuesta aceptada

Todd Flanagan
Todd Flanagan el 29 de Oct. de 2020
Editada: Todd Flanagan el 29 de Oct. de 2020
MWNumericArray(boolean rVal, boolean iVal, MWClassID classid)
This signature will take Java booleans and convert them to classid in MATLAB. There are Java signatures for all of the supported Java types like boolean, int8, double, etc.
boolean r = false;
boolean i = true;
MWNumericArray a = new MWNumericArray(r, i, MWClassID.LOGICAL);
In this case, if classid is "logical", there will be no conversion.
If classid is double, you will get a double array in MATLAB.
boolean r = false;
boolean i = true;
MWNumericArray a = new MWNumericArray(r, i, MWClassID.DOUBLE);
  2 comentarios
FM
FM el 29 de Oct. de 2020
Editada: FM el 29 de Oct. de 2020
It sounds like the description is incorrect, then.
The description says "double", but as I described, the actual type (for real and imaginary parts) seems like it is determined by the "MWClassID classid" argument. Except for the case where that argument is specified as "logical" (it's unclear what happens then, but I suspect it defaults to "double").
There's also the inconsistent use of "scalar" across the examples. Wondering if that's just an editorial error, or whether there is in fact something nonscalar in the first prototype.
Todd Flanagan
Todd Flanagan el 29 de Oct. de 2020
Hi,
I see what you are saying now.
Constructs a complex numeric double array that represents the primitive boolean arguments.
Should read somthing like:
Constructs a complex scaler numeric array that represents the primitive boolean arguments.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Java Package Integration en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by