Differences between revisions 1 and 2
Revision 1 as of 2008-06-23 10:28:10
Size: 1455
Comment:
Revision 2 as of 2008-06-23 10:29:20
Size: 1359
Comment:
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
See [http://www.mathworks.fr/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/rn/rn_intro.html&http://www.mathworks.fr/products/matlab/whatsnew.html Matlab 7.3 release notes] for more details. See [http://www.mathworks.fr/access/helpdesk/help/techdoc/rn/bqt6wtq.html Matlab 7.3 release notes] for more details.

MEX files on 64-bits architectures

Since Matlab 7.3, the following types are defined for MEX-files:

  • mwSize: represents size values, such as array dimensions and number of elements

  • mwIndex: represents index values, such as indices into arrays

On 32-bits machines, these types are simply aliases for int.

On 64-bits machines, it depends on whether one gives the -largeArrayDims for the MEX command:

  • without -largeArrayDims, these types are int (and therefore 32 bits)

  • with -largeArrayDims, these types are size_t, which is an alias for unsigned long (and therefore 64 bits)

See [http://www.mathworks.fr/access/helpdesk/help/techdoc/rn/bqt6wtq.html Matlab 7.3 release notes] for more details.

Since it is mandatory to use the -largeArrayDims when using sparse arrays on 64-bits architectures (and since this option will probably be the default in future versions of Matlab), Dynare's MEX-files are compiled with this option on 64-bits architectures.

This implies that, when coding MEX-files for Dynare, one should not expect that mwSize, mwIndex and int are synonymous.

In particular, appropriate type conversions should be made, especially when pointers are concerned. Such conversions are, for example, used in A_times_B_kronecker_C.

DynareWiki: MexFilesOn64BitsArch (last edited 2009-03-25 17:12:01 by localhost)