octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need tests for new MEX interface functions run in recent version of


From: Kai Torben Ohlhus
Subject: Re: Need tests for new MEX interface functions run in recent version of Matlab
Date: Wed, 15 Jan 2020 10:27:04 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0

On 1/15/20 7:50 AM, John W. Eaton wrote:
> I'm looking at adding the following new MEX interface functions to Octave
> 
>    mxGetDoubles  mxGetSingles
>    mxSetDoubles  mxSetSingles
> 
>    mxGetInt8s  mxGetInt16s  mxGetInt32s  mxGetInt64s
>    mxSetInt8s  mxSetInt16s  mxSetInt32s  mxSetInt64s
> 
>    mxGetUint8s  mxGetUint16s  mxGetUint32s  mxGetUint64s
>    mxSetUint8s  mxSetUint16s  mxSetUint32s  mxSetUint
> 
> To do that, I could use help understanding how they behave and how the
> older functions like mxGetPr behave with Matlab 2018a and newer versions
> that use interleaved complex data.
> 
> 1. Do the new functions like mxGetDoubles throw errors if the input
> mxArray object does not match the expected type or do they return some
> undefined result?
> 
> 2. If using the -r2018a option when compiling mex files so that they use
> the interleaved complex data interface, does the mxGetPr function return
> alternating real/imag values for a complex input array or does it throw
> an error?
> 
> Could someone try the following with the attached mextst.c file?  You'll
> need Matlab 2018a or a newer version.
> 
> If compiled with mex -r2018a and called with
> 
>   mextst ([1, 2])
> 
> I expect the output to be something like
> 
>   mxGetPr:       1.00000, 2.00000
>   mxGetDoubles:  1.00000, 2.00000
> 
> If called with
> 
>   mextst ([1+i, 2+2i])
> 
> Does mxGetPr throw an error because the type is wrong?  If not, what
> does it display?
> 
> Does mxGetDoubles fail with an error because the type of the argument is
> wrong?  If not, what does it display?
> 
> jwe

>> ver
-------------------------------------------------------------------------------------------------------
MATLAB Version: 9.6.0.1072779 (R2019a)
MATLAB License Number: sqrt(-42)
Operating System: Linux 4.12.14-lp151.28.36-default #1 SMP Fri Dec 6
13:50:27 UTC 2019 (8f4a495) x86_64
Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java
HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------------------------

>> mex -r2018a mextst.c
Building with 'gcc'.
Warning: You are using gcc version '7.5.0'. The version of gcc is not
supported. The version currently supported with MEX is '6.3.x'. For a
list of currently supported compilers see:
https://www.mathworks.com/support/compilers/current_release.
MEX completed successfully.

>> mextst ([1, 2])
mxGetPr:       1.000000, 2.000000
mxGetDoubles:  1.000000, 2.000000

>> mextst ([1+i, 2+2i])
Error using mextst
Array must not be complex.

%% Commenting out "//pr = mxGetPr" + following line and recompile

>> mextst ([1+i, 2+2i])

%% MATLAB CRASH!!!!

%% Commenting out "//d = mxGetDoubles" + following line and recompile

>> mextst ([1+i, 2+2i])
Error using mextst
Array must not be complex.


But it must be said for fairness, that in their reference example
"explore.c", TMW suggests to use the test "mxIsComplex ()" before
calling "mxGetDoubles ()".

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]